getById method

Future<T?> getById(
  1. String id
)

Implementation

Future<T?> getById(String id) async {
  _logger.d('[OfflineFirstRepository] Getting entity by ID: $id');
  final localEntity = await localRepository.getById(id);
  if (localEntity == null) {
    _logger.d(
        '[OfflineFirstRepository] Entity not found locally. Syncing and retrying');
    await _syncChanges();
    return localRepository.getById(id);
  }
  return localEntity;
}