lazyPutAsync<S> method

Future<S> Function() lazyPutAsync<S>(
  1. Future<S> builder(), {
  2. String? tag,
  3. bool permanent = false,
  4. bool isFactory = false,
})

Registers an asynchronous builder for lazy instantiation.

Implementation

Future<S> Function() lazyPutAsync<S>(
  Future<S> Function() builder, {
  String? tag,
  bool permanent = false,
  bool isFactory = false,
}) {
  final scope = _ScopeProvider.of(_context);
  if (scope != null) {
    return scope.lazyPutAsync<S>(
      builder,
      tag: tag,
      permanent: permanent,
      isFactory: isFactory,
    );
  }
  return Levit.lazyPutAsync<S>(
    builder,
    tag: tag,
    permanent: permanent,
    isFactory: isFactory,
  );
}