instanceOf<T extends Auth<AuthKeys>> static method

Authorizer<T> instanceOf<T extends Auth<AuthKeys>>()

Implementation

static Authorizer<T> instanceOf<T extends Auth>() {
  final current = _i;
  if (current == null) {
    throw AuthException(
      'Authorizer has not been initialised. '
      'Call Authorizer.init<T>() or attach an instance first.',
    );
  }
  if (current.isDisposed) {
    throw AuthException(
      'Authorizer has been disposed. Re-initialise before use.',
    );
  }
  if (current is! Authorizer<T>) {
    throw AuthException(
      'Type mismatch: expected Authorizer<$T> but the attached instance '
      'is ${current.runtimeType}.',
    );
  }
  return current;
}