isRegistered<T> method

bool isRegistered<T>({
  1. String? name,
})

Check if a type is registered in this container or any parent.

Parameters:

  • name: Optional name qualifier for named instances

Returns: true if the type is registered in this scope or any parent

Implementation

bool isRegistered<T>({String? name}) {
  final key = SpotKey<T>(T, name);

  // Check local registry
  if (registry.containsKey(key)) {
    return true;
  }

  // Check parent
  if (parent != null) {
    return parent!.isRegistered<T>(name: name);
  }

  return false;
}