Model class

Inheritance
Implementers

Constructors

Model([Map<String, dynamic> _data = const {}])
const
Model.from(BaseModel? other)
factory
Model.fromJson([Map<String, dynamic>? otherData])
const
Model.fromJsonString(String source)
factory
Model.of(Model other)
factory

Properties

$className String
The runtime type of this class as a String.
no setteroverride
data Map<String, dynamic>
no setter
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

equals(dynamic other) bool
Compares the BaseModel with another BaseModel using the DeepCollectionEquality and returns true if they are equal.
inherited
mergeWith(BaseModel? other, {bool deepMerge = false}) Model
Returns a new copy of the BaseModel with the fields updated from the other BaseModel. Set deepMerge to true to merge nested objects.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sortedJson({bool includeNulls = false}) Map<String, dynamic>
Returns a Json i.e. Map<String, dynamic> representation of the BaseModel, with the keys sorted alphabetically.
inherited
toJson({bool includeNulls = false}) Map<String, dynamic>
Returns a Json i.e. Map<String, dynamic> representation of the BaseModel.
override
toJsonString() String
Returns a JSON string representation of the BaseModel.
inherited
toString() String
A string representation of this object.
inherited
toUrl() Uri
Converts the current BaseModel 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.
inherited

Operators

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

Static Methods

fromJsonStringOrNull(String? source) Model?
removeDuplicateProperties<T extends Model>(Iterable<T> source, String k) List<T>
Returns a new list from source by removing duplicate properties with keys equal to k.
removeDuplicateRefs<T extends Model>(Iterable<T> source) List<T>
Returns a new list from source by removing duplicate keys equal to 'ref'.