While trying to build my app in release mode I encountered the following the compiler error:
"This application cannot tree shake icons fonts."
terminal logs:
flutter build ios --release
Building com.xxx.xxx for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: C7T4CHU88Y
Running Xcode build...
Xcode build done. 31.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following locations:
- file:///Users/user-app/lib/screens/categories/subcategories.dart:830:35
- file:///Users/user-app/lib/screens/home/home.dart:387:17
- file:///Users/user-app/lib/screens/home/home.dart:399:17
- file:///Users/user-app/lib/screens/home/home.dart:411:17
- file:///Users/user-app/lib/screens/home/home.dart:423:17
- file:///Users/user-app/lib/screens/product/all_products.dart:516:31
- file:///Users/user-app/lib/screens/tab/saveditems.dart:324:31
- file:///Users/user-app/lib/screens/tab/searchitem.dart:496:31
The error could result from the following file:
Column(
children: <Widget>[
Row(
children: <Widget>[
new Text(
MyLocalizations.of(context).goToCart,
style: textBarlowRegularBlack(),
),
SizedBox(width: 4),
Icon(
IconData(
0xe911,
fontFamily: 'icomoon',
),
color: Colors.black,
),
],
),
],
),
Try build with --no-tree-shake-icons
command.
Add a "const" before the IconData.
Icon(
const IconData(
0xe911,
fontFamily: 'icomoon',
),
color: Colors.black,
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With