abstract class ViewWidget<T extends ViewModel> extends StatefulWidget {
ViewWidget({
required T Function() builder,
String? name,
Location? location,
super.key,
}) : assert(T != ViewModel,
_missingGenericError('ViewWidget constructor', 'ViewModel')),
assert(location != Location.tree || name == null,
'ViewWidget cannot name a ViewModel that is not registered'),
_name = name,
_builder = builder,
_location = location;
}
Is there any reason why ViewWidget is not const? EVERY widget in Flutter must be const (even StatefulWidget, only the state is mutable).
This will have huge performance implications in memory consumption and GC collection, especially when using it in common components that are used more than once (for instance, in a list).
On src.dart, line 32:
Is there any reason why
ViewWidget
is notconst
? EVERY widget in Flutter must beconst
(evenStatefulWidget
, only the state is mutable).This will have huge performance implications in memory consumption and GC collection, especially when using it in common components that are used more than once (for instance, in a list).