find<T> static method

T find<T>({
  1. String? tag,
})

Retrieves a singleton instance of a class from the dependency store.

Returns the singleton instance of the class.

Throws an error if the class is not registered in the dependency store.

Implementation

static T find<T>({String? tag}) {
  final key = _getKey(T, tag: tag);
  if (_dependencyStore[key] == null) {
    throw 'Please use \nDependency.put($T()) \nbefore using \nDependency.find<$T>()'
        '\nException : class $T is not present in the Dependency store';
  }
  return _dependencyStore[key];
}