GenericModel class abstract

Base Class to be extended by

Inheritance
Available Extensions

Constructors

GenericModel()

Properties

fieldKeys Iterable<String>
Returns all the available field keys in this object.
no setteroverride
getterSetterMap MappableFields
Used by toMap to generate the map
latefinalinherited
hashCode int
The hash code for this object.
no setterinherited
id String?
Unique identifier for this model
getter/setter pairoverride
idKey String
Represents the field key used for the id
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String
Unique type to give to the model. Whether or not collision is expected is dependent on the parameters of your system.
no setteroverride
typeKey String
Represents the field key used for the type
no setteroverride

Methods

getField(String key) → dynamic
Returns the value of the field with name key or null if key is not a field in this model.
override
getGetterSetterMap() MappableFields
Implemented by subclasses to map the getters and setters of the object.
inherited
loadFromMap(Map<String, dynamic> map, {bool respectType = true}) → void
Loads a Serializable map into the values of this BaseModel
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setField(String key, dynamic value) bool
Sets the field with name key to the given value
override
toMap() Map<String, dynamic>
Converts this BaseModel into a Serializable Map.
override
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

convertEnumToString<T extends Enum>(Getter<T?> getter, Setter<T?> setter, Iterable<T> values) → Tuple2<Getter, Setter>
Converts the pair of Getter and Setter for an enum into the appropriate pair for storage (a String)
dateTime(Getter<DateTime?> getter, Setter<DateTime?> setter, {DateTimeConversion conversion = DateTimeConversion.microseconds}) → Tuple2<Getter, Setter>
Converts the pair of Getter and Setter for a DateTime into the appropriate serialized type.
model<T extends GenericModel>(Getter<T?> getter, Setter<T?> setter, Getter<T> supplier) → Tuple2<Getter, Setter>
Converts the pair of Getter and Setter for a GenericModel into the appropriate serialized type.
modelList<T extends GenericModel>(Getter<List<T>?> getter, Setter<List<T>?> setter, Getter<T> supplier) → Tuple2<Getter, Setter>
Converts the pair of Getter and Setter for a List of GenericModel into the appropriate serialized type.
modelMap<T extends GenericModel>(Getter<Map<String, T>?> getter, Setter<Map<String, T>?> setter, Getter<T> supplier) → Tuple2<Getter, Setter>
Converts the pair of Getter and Setter for a Map of GenericModel into the appropriate serialized type.
number(Getter<num?> getter, Setter<num?> setter) → Tuple2<Getter, Setter>
Takes the pair of Getter and Setter for a primitive and puts them in a Tuple2. Convenience function if you don't want to rely on the tuple package directly.
primitive<T>(Getter<T?> getter, Setter<T?> setter) → Tuple2<Getter, Setter>
Takes the pair of Getter and Setter for a primitive and puts them in a Tuple2. Convenience function if you don't want to rely on the tuple package directly.

Constants

ID → const String
The key for id in the result of toMap
TYPE → const String
The key for type in the result of toMap