I am able to run the app on my computer. But when I create a pull request on Github, it is showing an error while checking:
“This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations: Product_Model”
The code snippet as follows:
class ProductModel extends Equatable {
final DocumentReference selfRef;
final String productName;
final String description;
final DocumentReference defaultPlan;
final IconData icon;
const ProductModel(
{required this.selfRef,
required this.productName,
required this.defaultPlan,
required this.icon,
required this.description});
factory ProductModel.fromSnapshot(
DocumentSnapshot<Map<String, dynamic>> snapshot) {
final data = snapshot.data()!;
return ProductModel(
selfRef: snapshot.reference,
productName: data['name'] as String,
defaultPlan: data['defaultPlan'],
icon: IconData(data['iconId'] as int, fontFamily: 'MaterialIcons'),
description: data['description'] as String);
}
@override
List<Object> get props => [selfRef, productName, defaultPlan, icon];
}
Why is this running on my computer but not Github? What is the fix for this?