MModel class

Represents an entity defined by a json-schema.

In memory, the values are stored in the wrapped property, which is essentially a map of json values. A MModel is a non-persisted entity, where as MEntity represents a persisted entity that has an ID

Implemented types
Mixed-in types
  • DiffDelegateMixin
Implementers
Available extensions

Constructors

MModel(Map<String, dynamic>? values, {MSchemaRef? mtype, bool? update})

Properties

diffHashCode → int
no setterinherited
diffKey → dynamic
For Diffable
no setteroverride
diffSource → dynamic
For Diffable
no setteroverride
hashCode → int
The hash code for this object.
no setteroverride
id → String?
no setter
ignoredPaths → Set<JsonPath>
no setter
mfields → Set<String>
no setteroverride
mkey → MKey?
no setteroverride
mkeyOrNull → MKey?
no setter
mtype → MSchemaRef
no setteroverride
recordKey → RecordKey?
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
wrapped → Map<String, dynamic>
final
wrappedOrEmpty → Map<String, dynamic>

Available on MModel?, provided by the MModelExt extension

no setter
wrappedValues → Map<String, dynamic>

Available on MModel?, provided by the MModelExt extension

Returns the json payload, but omits any metadata values
no setter

Methods

call<T>(dynamic key) → T?
clone() → dynamic
override
diffEquals(dynamic other) → bool
inherited
diffIdentical(dynamic other) → bool
inherited
get(String name) → dynamic
getByPath<T>(JsonPath path) → T
override
has(String fieldName) → bool
jpath<T>(JsonPath<T> path, [T? value]) → T?
modified() → dynamic
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prune(Set<String> fields) → void
setByPath<T>(JsonPath<T> path, T? value) → dynamic
override
sync([Set<String>? fields]) → void
There are some weird cases where collections aren't synced properly with the underlying json. This will overwrite the json with the latest value of the variable.
takeFrom(dynamic source) → void
override
takeFromMap(Map<String, dynamic>? from, {bool copyEntries = true}) → void
Used for meta-forms in setting deep properties
override
toMap() → Map<String, dynamic>
For RouteParams - move at some point?
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
override
operator [](dynamic key) → dynamic
override
operator []=(String key, dynamic value) → void
override

Static Methods

fromJson(dynamic json) → MModel?