ResCollection<T extends ResModel> class

Constructors

ResCollection.new({required ResClient client, required String rid, required T modelFactory()})

Properties

addEventsController StreamController<T>
getter/setter pair
addListener StreamSubscription
getter/setter pair
client ResClient
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
modelFactory ↔ T Function()
getter/setter pair
models List<T>
getter/setter pair
removeEventsController StreamController<T>
getter/setter pair
removeListener StreamSubscription
getter/setter pair
rid String
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addModelsFromJson(Map<String, dynamic> data) → void
Go through the data and create instances for each model and add them to the internal list. Also listens for change events for each created model.
createModelFromJson(String rid, Map<String, dynamic> json) → T
Create an instance of a model and listen for its change events.
destroy() Future<void>
Unsubscribe from this collection and close the event streams Also closes the event stream of each model within this collection.
listen() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAdd(void handler(T)) StreamSubscription<T>
Execute handler everytime a model is added to this collection.
onRemove(void handler(T)) StreamSubscription<T>
Execute handler everytime a model is removed from the collection.
toString() String
A string representation of this object.
inherited

Operators

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