read<T extends Object> method

T? read<T extends Object>({
  1. String? mark,
  2. bool disposable = false,
})

Get global shared object.

mark -- The unique identifier of the shared object to be registered. If there is only one shared object of the same type in the project, it can be used to distinguish it. Otherwise, it needs to be used to distinguish it.

disposable -- Gets whether the global shared object is one-time consumption. Even if you use it once, you can't use it again next time.

Implementation

T? read<T extends Object>({
  String? mark,
  bool disposable = false,
}) {
  final String key = keyGet<T>(mark);
  if (disposable) {
    _recordPool.remove(key);
  }
  return instanceGet(_recordPool, key);
}