aloisdeniel / built_bloc

Generate the BLoC pattern boilerplate.
MIT License
51 stars 5 forks source link

Another case of dynamic generated #4

Open jaumard opened 5 years ago

jaumard commented 5 years ago
@sink
@Bind('_handleColorModification')
final PublishSubject<Color> _changeColor = PublishSubject();  

Is generated to :

Sink<dynamic> get changeColor => this._parent._changeColor.sink;
rrousselGit commented 5 years ago

The issue is about code generation in general. Generators don't have access to dart:ui

jaumard commented 5 years ago

Ho didn't know that ! That explain why I also have it for Locale ^^ Thanks for the explanation @rrousselGit ! Is it something the dart team is working on ? Look like a small limitation but can by quite annoying... Wondering why generators can't have access to this one

rrousselGit commented 5 years ago

Because dart:ui is flutter only. While generators are using the real dart sdk

aloisdeniel commented 5 years ago

Any tip to fix that @rrousselGit ? If I remember well you encountered the same issue with functional_widget.

rrousselGit commented 5 years ago

I manually extracted the type name through computeNode when a DartType has isUnknown.

But this is not even remotely close to covering all scenarios.

aloisdeniel commented 5 years ago

Okay, thanks @rrousselGit.

Just looked the computeNode declaration and it is now deprecated. :/

And it looks like it will be funny to get the parameter type token from the original type from that...