Errors
lib/flutter_flow/flutter_flow_widgets.dart:215:28:
Error: The argument type 'IconData' can't be assigned to the parameter type 'FaIconData?'.
- 'IconData' is from 'package:flutter/src/widgets/icon_data.dart'
- 'FaIconData' is from 'package:font_awesome_flutter/src/icon_data.dart'
widget.iconData!,
^
lib/flutter_flow/flutter_flow_icon_button.dart:67:14:
Error: The argument type 'IconData?' can't be assigned to the parameter type 'FaIconData?'.
- 'IconData' is from 'package:flutter/src/widgets/icon_data.dart'
- 'FaIconData' is from 'package:font_awesome_flutter/src/icon_data.dart'
icon.icon,
^
---
Root Cause
font_awesome_flutter: 11.0.0 introduced a breaking change:
βββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β Version β FaIcon constructor parameter type β
βββββββββββΌββββββββββββββββββββββββββββββββββββ€
β ^10.x β IconData? (Flutter built-in) β
βββββββββββΌββββββββββββββββββββββββββββββββββββ€
β 11.0.0 β FaIconData? (new dedicated type) β
βββββββββββ΄ββββββββββββββββββββββββββββββββββββ
The two template files have not been updated to reflect this change:
- flutter_flow_widgets.dart declares final IconData? iconData and passes it to FaIcon(widget.iconData!, ...), which
now requires FaIconData?.
- flutter_flow_icon_button.dart casts a widget to FaIcon and passes icon.icon (inferred as IconData?) to another
FaIcon(...) constructor, which also now requires FaIconData?.
These are compile-time type errors in the generated template files themselves. They occur regardless of whether the
project uses any FontAwesome icons β any project with buttons or icon buttons will hit this error during web
compilation.
---
Steps to Reproduce
1. Create any FlutterFlow project that includes at least one Button or IconButton widget.
2. Attempt to publish as a web deployment.
3. Observe the dart2js compilation failure above.
---
Expected Behavior
Web deployment compiles successfully.
Actual Behavior
dart2js compilation fails with type errors in flutter_flow_widgets.dart and flutter_flow_icon_button.dart.
---
Suggested Fix
Option A β Update the template files to use FaIconData:
In flutter_flow_widgets.dart:
// Before
final IconData? iconData;
// After
final FaIconData? iconData;
In flutter_flow_icon_button.dart:
// Before
FaIcon icon = widget.icon as FaIcon;
effectiveIcon = FaIcon(icon.icon, ...); // icon.icon is now FaIconData?
// After β no change needed if FaIcon.icon already returns FaIconData?
// Ensure the variable/parameter chain accepts FaIconData? throughout
Option B β Downgrade the pinned font_awesome_flutter version back to ^10.7.0 in the project template until the
template files are updated.
---
Environment
- FlutterFlow project type: Firebase / Web deployment
- font_awesome_flutter version in generated pubspec.yaml: 11.0.0
- Build target: Web (dart2js)
- Native builds (iOS/Android): unaffected