flutter_eval
flutter_eval copied to clipboard
@Bind() generates $TextStyle references without import
The bindings generator creates calls to $TextStyle.wrap(...), but does not add the proper import/reference to the $TextStyle wrapper class. As a result, the analyzer/compiler fails with Undefined name '$TextStyle'.
Steps to Reproduce
- Define a class with @Bind() that extends TextTheme and overrides some properties:
@Bind()
class DemoTypography extends TextTheme with AppTypography {
const DemoTypography();
@override
TextStyle get displayLG =>
GoogleFonts.montserrat(fontSize: 28, fontWeight: FontWeight.w700);
@override
TextStyle get displayMD =>
GoogleFonts.montserrat(fontSize: 24, fontWeight: FontWeight.w800);
}
-
Run dart_eval bind and generate bindings.
-
The generated code for $getProperty looks like this (excerpt):
case 'displayLG':
final _displayLG = $value.displayLG;
return $TextStyle.wrap(_displayLG);
- Compilation fails with:
Error: Undefined name '$TextStyle'.
Expected Behavior
The generator should either:
Import the correct $TextStyle wrapper, or
Generate references that resolve correctly without manual fixes.
Actual Behavior
Code references $TextStyle without any import, leading to Undefined name '$TextStyle'.
and same problem with
return $Color.wrap(_brand800);