You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This language feature would be a step towards removing the createState method: StatefulWidget would accept a generic parameter and use that to provide a default createState implementation:
- class Foo extends StatefulWidget {+ class Foo extends StatefulWidget<_FooState> {
const Foo();
-- @override- State<Foo> createState() => _FooState();
}
Introduction
It would be nice if Dart could instantiate a generic type. For example:
This would likely need some sort of generic constraint to ensure
T
can be instantiated.Use case
Today, a Flutter
StatefulWidget
must implement thecreateState
method:This language feature would be a step towards removing the
createState
method:StatefulWidget
would accept a generic parameter and use that to provide a defaultcreateState
implementation:Previous discussions
The following issues appear relevant:
Type
objects #4200Feel free to close this if there is a better tracking issue already :)
The text was updated successfully, but these errors were encountered: