isRegistered<S> method

bool isRegistered<S>({
  1. dynamic key,
  2. String? tag,
})

Whether type S is registered in the current or any parent scope.

Implementation

bool isRegistered<S>({dynamic key, String? tag}) {
  if (key is LevitStore) {
    final scope = _ScopeProvider.of(_context) ?? Ls.currentScope;
    return key.isRegisteredIn(scope, tag: tag);
  }
  if (key is LevitAsyncStore) {
    final scope = _ScopeProvider.of(_context) ?? Ls.currentScope;
    return key.isRegisteredIn(scope, tag: tag);
  }
  final scope = _ScopeProvider.of(_context);
  if (scope != null) {
    return scope.isRegistered<S>(tag: tag);
  }
  return Levit.isRegistered<S>(tag: tag);
}