RocketModel<T> class
abstract
An abstract class that defines the behavior of a model object.
A model object is a class that represents data and provides methods for managing and updating that data. The data can be stored in various forms (e.g. in-memory, in a database, or on a server) and can be accessed and manipulated through the model object's public methods.
- Inheritance
-
- Object
- RocketListenable
- RocketModel
Constructors
Properties
-
all
↔ List<
T> ? -
A list of all data objects of type T.
getter/setter pair
- apiResponse ↔ dynamic
-
getter/setter pair
- enableDebug → bool
-
A flag indicating whether debug mode is enabled.
no setter
- exception ↔ RocketException
-
An exception object that represents any errors that occur during data loading or manipulation.
getter/setter pair
- existData ↔ bool
-
A flag indicating whether the model contains any data.
getter/setter pair
-
getListenersKeys
→ List<
String> -
Returns a list of all keys that have registered listeners.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Returns true if this object has any listeners.
no setterinherited
- instance ↔ dynamic
-
The dynamic instance of the model.
getter/setter pair
- isMerged → bool
-
Returns true if this object is merged with other objects.
no setterinherited
- loadingChecking ← bool
-
Sets the loading checker flag.
no getter
-
merges
↔ List<
RocketListenable> -
A list of RocketListenable objects that this object is merged with.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state ↔ RocketState
-
Returns the current state of the model.
getter/setter pair
- statusCode ↔ int?
-
getter/setter pair
Methods
-
addItem(
T newModel) → void - Adds a new data object.
-
callListener(
String key) → void -
Notifies the listeners registered with the specified key.
inherited
-
callListeners(
List< String> keys) → void -
Notifies the listeners registered with any of the specified keys.
inherited
-
delItem(
int index) → void - Deletes the data object at the specified index.
-
dispose(
) → void -
Disposes of this object and removes all listeners.
inherited
-
fromJson(
Map< String, dynamic> ? json, {bool isSub = false}) → void - Deserializes the model's data from the given JSON map.
-
keyHasListeners(
String key) → bool -
Returns true if a listener is registered with the specified key.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rebuildWidget(
{bool fromUpdate = false}) → void - Notifies listeners that the model has changed and needs to be rebuilt.
-
registerListener(
String key, VoidCallback listener) → void -
Registers a new listener with the specified key.
inherited
-
registerListeners(
Map< String, List< listeners) → voidVoidCallback> > -
Registers multiple listeners with the specified keys.
inherited
-
removeListener(
String key, [VoidCallback? listener]) → void -
Removes the specified listener (or all listeners if no listener is specified) with the specified key.
inherited
-
removeListeners(
List< String> keys, [List<VoidCallback> ? listeners]) → void -
Removes the specified listeners (or all listeners if no listener is specified) with the specified keys.
inherited
-
setException(
RocketException rocketException) → void - Sets the exception object with the given exception.
-
setMulti(
List data) → void - Sets the model's data to the given list of data.
-
toJson(
) → Map< String, dynamic> - Serializes the model's data to a JSON map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited