get<T extends Object?> method

T? get<T extends Object?>([
  1. String? id,
  2. Object? ref
])

Creates and/or gets the instance of T with an id optional.

Under the following conditions:

  • if found it, returns it.
  • if not found and has registered it, creates and returns it.
  • else returns null.

Implementation

T? get<T extends Object?>([String? id, Object? ref]) {
  return _getOrCreateIfNotExtist<T>(id, ref)?.instance;
}