-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: buildBuilding flutter applications with the toolBuilding flutter applications with the toolhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool teamwaiting for PR to land (fixed)A fix is in flightA fix is in flight
Description
Working on a new widget in the widgets layer, I defined a const Icon using the ascii value for the IconData:
const Icon(IconData(0x25BA));Since the Icon widget is defined in the widgets layer, I thought this should work fine. Running an app with this builds and works fine.
When I pushed a PR, CI was very unhappy. This use of Icon results in an error from the IconTreeShaker.
flutter build apk --release
Target aot_android_asset_bundle failed: IconTreeShakerException: Invalid ConstFinder result. Expected "fontPackage" to be a String, "fontFamily" to be a String, and "codePoint" to be an int, got: {codePoint: 9658, fontFamily: null, fontPackage: null, matchTextDirection: false, fontFamilyFallback: null}.
To disable icon tree shaking, pass --no-tree-shake-icons to the requested flutter build command
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command '/Users/katelovett/_github/flutter/bin/flutter'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 14s
Running Gradle task 'assembleRelease'... 14.7s
Gradle task assembleRelease failed with exit code 1
I figured I was holding it wrong and was not allowed to do this, but @goderbauer suspects this is a bug in the icon tree shaker script.
This can be reproduced with the following code and the command flutter build apk --release
import 'package:flutter/material.dart';
void main() => runApp(const SliverTreeExampleApp());
class SliverTreeExampleApp extends StatelessWidget {
const SliverTreeExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: SliverTreeExample(),
);
}
}
class SliverTreeExample extends StatelessWidget {
const SliverTreeExample({super.key});
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(child: Icon(IconData(0x25BA)),),
);
}
}
This is an example build where I saw this in CI: https://ci.chromium.org/ui/p/flutter/builders/try/Linux%20build_tests_2_3/33418/overview
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: buildBuilding flutter applications with the toolBuilding flutter applications with the toolhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool teamwaiting for PR to land (fixed)A fix is in flightA fix is in flight