getEntityRepository<O extends Object> method

EntityRepository<O>? getEntityRepository<O extends Object>({
  1. O? obj,
  2. Type? type,
  3. String? name,
})

Implementation

EntityRepository<O>? getEntityRepository<O extends Object>(
    {O? obj, Type? type, String? name}) {
  if (isClosed) return null;

  if (_callingGetEntityRepository) return null;
  _callingGetEntityRepository = true;

  checkInitialized();

  try {
    var entityRepository =
        _getEntityRepositoryImpl<O>(obj: obj, type: type, name: name);
    if (entityRepository != null) {
      return entityRepository;
    }

    if (!identical(this, _globalProvider)) {
      return _globalProvider._getEntityRepositoryImpl<O>(
          obj: obj, type: type, name: name);
    }

    return null;
  } finally {
    _callingGetEntityRepository = false;
  }
}