LScopedView<T>.put constructor
LScopedView<T>.put (})
Shorthand for creating a scope, immediately registering a dependency, and consuming it.
Implementation
factory LScopedView.put(
T Function() create, {
Key? key,
String? tag,
bool permanent = false,
required Widget Function(BuildContext context, T controller) builder,
Widget Function(BuildContext context)? orElse,
bool autoWatch = true,
String? scopeName,
List<Object?>? args,
}) {
return LScopedView<T>(
key: key,
scopeName: scopeName,
args: args,
dependencyFactory: (s) {
s.put<T>(create, tag: tag, permanent: permanent);
},
resolver: (context) => context.levit.findOrNull<T>(tag: tag),
builder: builder,
orElse: orElse,
autoWatch: autoWatch,
);
}