fetchRelated<R extends DatumEntityInterface> method

Future<List<R>> fetchRelated<R extends DatumEntityInterface>(
  1. T parent,
  2. String relationName, {
  3. DataSource source = DataSource.local,
})

DEPRECATED: This method will be removed in a future version. Use the withRelated parameter in the query method for eager loading, or the fetch() method on the relation object for lazy loading. Fetches related entities for a given parent entity.

  • parent: The entity instance for which to fetch related data. This must be an instance of RelationalDatumEntity.
  • relationName: The name of the relation to fetch, as defined in the parent's belongsTo or manyToMany maps.
  • source: The DataSource to fetch from (defaults to local).

Returns a list of the related entities. Throws an ArgumentError if the parent is not a RelationalDatumEntity, or an Exception if the relation name is not defined on the parent.

Implementation

Future<List<R>> fetchRelated<R extends DatumEntityInterface>(
  T parent,
  String relationName, {
  DataSource source = DataSource.local,
}) async {
  _ensureInitialized();
  return _relationLoader.fetchRelated<R>(parent, relationName, source: source);
}