LAsyncView<T>.put constructor
LAsyncView<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,
Registers an async dependency of type T and consumes it.
Implementation
factory LAsyncView.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,
}) {
return LAsyncView<T>(
key: key,
resolver: (context) async {
context.levit.lazyPutAsync<T>(create,
tag: tag, permanent: permanent, isFactory: isFactory);
return context.levit.findAsync<T>(tag: tag);
},
builder: builder,
autoWatch: autoWatch,
loading: loading,
error: error,
args: args,
);
}