Closed derolf closed 4 years ago
The issue is on https://github.com/dart-lang/build/issues/733. functional_widget
cannot do anything about it, sadly.
I don't get what the actual problem is... because it works for other types...
However, a workaround is to declare VoidCallback
in the same (original) file.
The issue is, voidcallback is originally defined in Flutter. Which code generators don't have access to. So the type do not resolve
Got it! Probably you should mention that in the docs...
Can this happen to other types as well? Can’t you just handle unknown types as “opaque”?
I am not able to replicate this issue in a test. Do you know how to do that?
Wait, Voidcallback? The issue should happen for things from dart:ui only, like Color.
Voidcallback should work (although the generator will instead write void Function()
I have a fix. Should work now. It builds the parameter list from the AST instead of Element.
Any progress on this one? It's a blocker for me...
No. You can make a PR if you need to.
I'm getting same issue for basically any custom type defined outside of file with widget.
You might want to revamp https://github.com/rrousselGit/functional_widget/pull/48
@rrousselGit Can you take a look at PR @derolf submitted when you have a minute? This lib is awesome and it would be great to get this issue fixed.
with the latest version, i can no longer recreate this bug.
@widget
Widget foo(VoidCallback bar) => Container();
generates for me (excuse HookWidget
but it should be the same anyway)
class Foo extends HookWidget {
const Foo(this.bar, {Key key}) : super(key: key);
final void Function() bar;
@override
Widget build(BuildContext _context) => foo(bar);
}
Good catch
Example:
generates
resulting in error: