EntityReferenceList<T> class

Reference wrapper to an entity List.

Inheritance
Available Extensions

Constructors

EntityReferenceList.asEmpty({Type? type, String? typeName, EntityHandler<T>? entityHandler, EntityProvider? entityProvider, EntityHandlerProvider? entityHandlerProvider, EntitiesFetcher<T>? entitiesFetcher, EntityCache? entityCache, bool checkGenericType = true})
Creates an empty EntityReferenceList (like an empty list). See isEmpty, ids and isIDsSet.
EntityReferenceList.asNull({Type? type, String? typeName, EntityHandler<T>? entityHandler, EntityProvider? entityProvider, EntityHandlerProvider? entityHandlerProvider, EntitiesFetcher<T>? entitiesFetcher, EntityCache? entityCache, bool checkGenericType = true})
Creates an EntityReferenceList with null entities and null ids. See isNull, ids and isIDsSet.
EntityReferenceList.from(Object? o, {Type? type, String? typeName, EntityHandler<T>? entityHandler, EntityProvider? entityProvider, EntityHandlerProvider? entityHandlerProvider, EntityCache? entityCache, EntitiesFetcher<T>? entitiesFetcher})
Creates an EntityReferenceList from o trying to resolve it in the best way.
factory
EntityReferenceList.fromEntities(Iterable<T?>? entities, {Type? type, String? typeName, EntityHandler<T>? entityHandler, EntityProvider? entityProvider, EntityHandlerProvider? entityHandlerProvider, EntitiesFetcher<T>? entitiesFetcher, EntityCache? entityCache, bool checkGenericType = true})
Creates an EntityReferenceList with the entities instances list. The ids is resolved through the entities instance list. See entities and isEntitiesSet.
EntityReferenceList.fromEntitiesMaps(Iterable<Map<String, dynamic>?> entitiesMaps, {Type? type, String? typeName, EntityHandler<T>? entityHandler, EntityProvider? entityProvider, EntityHandlerProvider? entityHandlerProvider, EntitiesFetcher<T>? entitiesFetcher, EntityCache? entityCache, bool checkGenericType = true})
Creates an EntityReferenceList with an entities instance list from entitiesMaps.
EntityReferenceList.fromIDs(List<Object?>? ids, {Type? type, String? typeName, EntityHandler<T>? entityHandler, EntityProvider? entityProvider, EntityHandlerProvider? entityHandlerProvider, EntitiesFetcher<T>? entitiesFetcher, EntityCache? entityCache, bool checkGenericType = true})
Creates an EntityReferenceList with the entities ids (without a loaded entities list). See ids and isIDsSet.
EntityReferenceList.fromJson(Map<String, dynamic> json, {Type? type, String? typeName, EntityHandler<T>? entityHandler, EntityProvider? entityProvider, EntityHandlerProvider? entityHandlerProvider, EntitiesFetcher<T>? entitiesFetcher, EntityCache? entityCache})
Creates an EntityReference from a JSON Map. If json has an entry EntityReference it will be treated as a Map from toJson, otherwise will be treated as an entity JSON (a Map from entitiesToJson) and instantiated through fromEntityMap.
factory

Properties

currentValue Object?
Returns the current internal value (entities OR ids).
no setteroverride
entities List<T?>?
The already loaded entities.
no setter
entitiesNotNull List<T>
Non-nullable version of entities.
no setter
entitiesOrIDs List<Object?>?
Returns entities OR ids. See isEntitiesSet and isIDsSet.
no setter
entitiesTime DateTime?
The DateTime of when the entities was set.
no setter
entityHandler EntityHandler<T>?
The EntityHandler for this entity type.
no setterinherited
entityProvider EntityProvider?
The EntityProvider for this entity type.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
ids List<Object?>?
The entities IDs.
no setter
idsNotNull List<Object>
Non-nullable versions of ids.
no setter
isEmpty bool
Returns true if length is 0 and NOT null.
no setter
isEmptyOrNull bool
Returns true if length is 0 OR null.
no setter
isEntitiesSet bool
Returns true if the entities instances are loaded.
no setter
isIDsSet bool
Returns true if ids is set.
no setter
isLoaded bool
Returns true if the entities is loaded;
no setteroverride
isNotEmpty bool
Returns true if length is >= 1 and NOT null.
no setter
isNotEmptyOrNull bool
Returns true if length is >= 1 OR null.
no setter
isNotNull bool
Returns true if this reference is NOT null.
no setterinherited
isNull bool
Returns true if this reference is null (no ids or entities set).
no setteroverride
length int?
Returns the length of entities of this EntityReferenceList. See entities and ids.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type Type
The entities Type.
no setteroverride
typeName String
The entities Type name.
no setteroverride

Methods

add(T o) → void
addAll(Iterable<T> os) → void
cast<E>() EntityReferenceList<E>
override
copy({bool withEntity = true}) EntityReferenceList<T>
Returns a copy of this EntityReference instance.
override
disposeEntities() List<T?>?
Disposes the current loaded entity instance and returns it. Id id is defined it will keep it.
entitiesOrIDsToJson() Object?
Encodes entities or ids as JSON. If isNull returns null.
entitiesToJson([JsonEncoder? jsonEncoder]) List<Map<String, dynamic>?>?
Returns entities as a JSON List of entities Map.
equalsEntitiesIDs(Object? otherEntities) bool?
fetchImpl() FutureOr<List<T?>?>
Fetches the entity, but won't set it. Do not call this directly.
get() FutureOr<List<T?>?>
Returns the current entity or fetches it.
override
getAt(int index) FutureOr<T?>
getNotNull() FutureOr<List<T?>>
Same as get but won't return null.
override
idsAs<I>() List<I?>
Returns the ids with type I or null. See idsNotNullAs.
idsNotNullAs<I>() List<I>
Returns the ids with type I. See idsAs.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() FutureOr<List<T?>?>
Refreshes the entities fetching them.
override
remove(T? o) bool
removeByID(Object? id) bool
set(List<T?>? os) List<T?>?
Sets the entities to os and returns the current entities.
setIDs(List<Object?>? ids) Object?
Sets the entities ids and returns the current ids. If the IDs is changing the previous loaded entities instance are disposed.
toEntityReference() EntityReference<T>
Returns this as an EntityReference instance. If this instance length is > 1 it will thrown an StateError.
toJson([JsonEncoder? jsonEncoder]) Map<String, dynamic>?
Encodes this EntityReferenceList instance to JSON.
override
toString({bool withT = true}) String
A string representation of this object.
override
updateIDsFromEntities() bool
Updated ids from entities isntances IDs.

Operators

operator ==(Object other) bool
The equality operator.
override