Model class abstract
Abstract class serving as a template for data models.
- Implementers
Constructors
- Model()
Properties
- $class ↔ String
-
The class name of the model as a string.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setteroverride
- id ↔ String?
-
The unique identifier of the model.
getter/setter pair
- ref ↔ DataRefModel?
-
The unique reference to the model.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copy<
T extends Model> () → T - Returns a new copy of the Model with the exact same fields.
-
copyWith<
T extends Model> (Model? other) → T -
Returns a new copy of the Model with the fields updated from the
other
Model. -
copyWithJson<
T extends Model> (Map< String, dynamic> ? otherData) → T -
Returns a new copy of the Model with the fields updated from
otherData
. -
empty<
T extends Model> () → T -
Returns a new instance of the Model with all fields set to
null
. -
equals(
dynamic other) → bool -
Compares the Model with another Model using the
DeepCollectionEquality
and returnstrue
if they are equal. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sortedJson(
{dynamic defaultValue, bool includeNulls = false}) → Map< String, dynamic> -
Returns a Json i.e.
Map<String, dynamic>
representation of the Model, with the keys sorted alphabetically. -
toJson(
{dynamic defaultValue, bool includeNulls = false}) → Map< String, dynamic> -
Returns a Json i.e.
Map<String, dynamic>
representation of the Model. -
toJsonString(
) → String - Returns a JSON string representation of the Model.
-
toString(
) → String -
A string representation of this object.
override
-
toUrl(
) → Uri - Converts the current Model to a Uri that can be used as a distinct identifier. The model must not be too large to avoid exceeding the maximum length of a URL.
-
updateWith(
Model? other) → void -
Updates the fields of the Model with the fields from the
other
Model. -
updateWithJson(
Map< String, dynamic> ? otherData) → void -
Updates the fields of the Model with the fields from
otherData
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
removeDuplicateIds<
T extends Model> (Iterable< T> source) → List<T> -
Returns a new list from
source
by removing duplicate keys equal to K_ID. -
removeDuplicateProperties<
T extends Model> (Iterable< T> source, String k) → List<T> -
Returns a new list from
source
by removing duplicate properties with keys equal tok
. -
removeDuplicateRefs<
T extends Model> (Iterable< T> source) → List<T> -
Returns a new list from
source
by removing duplicate keys equal to K_ID.