LScopedAsyncView<T>.put constructor
LScopedAsyncView<T>.put (
- Future<
T> create(), { - Key? key,
- String? tag,
- bool permanent = false,
- bool isFactory = false,
- required Widget builder(
- BuildContext context,
- T controller
- bool autoWatch = true,
- Widget loading(
- BuildContext context
- Widget error(
- BuildContext context,
- Object error
- List<
Object?> ? args, - String? scopeName,
Shorthand for creating a scope, registering an async dependency, and consuming it.
Implementation
factory LScopedAsyncView.put(
Future<T> Function() create, {
Key? key,
String? tag,
bool permanent = false,
bool isFactory = false,
required Widget Function(BuildContext context, T controller) builder,
bool autoWatch = true,
Widget Function(BuildContext context)? loading,
Widget Function(BuildContext context, Object error)? error,
List<Object?>? args,
String? scopeName,
}) {
return LScopedAsyncView<T>(
key: key,
scopeName: scopeName,
args: args,
dependencyFactory: (s) {
s.lazyPutAsync<T>(
create,
tag: tag,
permanent: permanent,
isFactory: isFactory,
);
},
resolver: (context) => context.levit.findAsync<T>(tag: tag),
builder: builder,
autoWatch: autoWatch,
loading: loading,
error: error,
);
}