Dart/Flutter support for delegates
2,464
The only one that I know of that is delegate "like" is typedef
. It really is a way to strongly type callbacks. A common one is WidgetBuilder
typedef Widget WidgetBuilder(BuildContext context);
or the more preferred way of writing a callback
typedef WidgetBuilder = Widget Function(BuildContext context);
But you can also build your own
Author by
Yarm
Updated on December 04, 2022Comments
-
Yarm over 1 year
Does Dart 2.0 support the concept of a delegate? Having reviewed the documentation I assume not. So is this is an omission? Or is there an alternate approach to achieving the same? Possibly using streams?
-
Edman almost 6 yearsWhat kind of delegation are you looking for?
-
Yarm almost 6 yearsA page calls a route which calls another route. Tthen an action pops both the second route and calls a delegate to Also pop the first route.
-
matanlurey almost 6 yearsThis is unrelated to Dart. You're looking for a Flutter feature?
-
Yarm almost 6 yearsNo, looking for a language feature (dart) to use with the framework (flutter).
-