fetch method

Future<List<T>?> fetch()

Implementation

Future<List<T>?> fetch() async {
  if (_isLoaded) {
    return _value;
  }
  final localKeyValue = _parent.toDatumMap()[localKey];
  if (localKeyValue == null) {
    return [];
  }
  final manager = getRelatedManager();
  final related = await manager.query(
    DatumQuery(filters: [Filter(foreignKey, FilterOperator.equals, localKeyValue)]),
    source: DataSource.local,
    userId: _parent.userId,
  );
  _value = related;
  _isLoaded = true;
  return related;
}