-
-
Notifications
You must be signed in to change notification settings - Fork 155
Open
Description
After the latest Flutter upgrade, registerSingleton inside of VoidCallback is not working anymore:
It worked before Dart 3.0. Now they probably have stricter type checking.
In runtime it crashes with the following error

The bug disappears when I explicitly indicate the type:

This bug appears in VoidCallback only, not in a plain code. It also can be fixed if I used:
() {} instead of () =>
The reason behind: a generic by default takes the root return type (void), and Dart tries to put void into T extends Object constraint, and this apparently causes this assert to be falsely posivite:

Any ideas on it?
Git-GA
Metadata
Metadata
Assignees
Labels
No labels