immutable_model library

The main library, exposing the ImmutableModel class, ModelSelector and the static M class containing model shorthands.

Using the shorthands defined in M is the recommended way of defining ModelType's used in an ImmutableModel.

Classes

ImmutableModel<S>
The main class used to define immutable state models.
M
An abstract holding class defining shorthands for the constructors of each model defined in this library.
ModelSelector<V>
A class used to select a model in an ImmutableModel or ModelInner, where V is the model's value type.

Enums

ModelState
Default placeholder state for ImmutableModel's

Typedefs

ModelListItemValidator<V> = bool Function(V listItem)
A function that validates an item from a list
ModelMapValidator = bool Function(Map<String, ModelType<ModelType, dynamic>> modelMap)
A function that validates modelMap.
ModelValueUpdater = dynamic Function(dynamic currentValue)
A function that updates the value of a model based on its currentValue.
ModelValueValidator<V> = bool Function(V value)
A function that validates the value passed to it.

Exceptions / Errors

ModelAccessError
An Error that occurs when an attempt is made to access a model that does not exist in a potentially.
ModelDeserializationException
An Exception that occurs when a value cannot be deserialized using a model's ModelType.deserialize method.
ModelEnumError
An Error that occurs when an EnumModel is updated with a string that does not match any of the internal enums.
ModelException
The abstract Exception used for model exceptions
ModelHistoryEqualityError
An Error that occurs when a model is being updated with another model that does not share a history with it.
ModelInitializationError
An Error that occurs during the initialization of a model.
ModelInitialValidationError
An Error that occurs when a model is being initialized with a value that does not validated.
ModelInnerStrictUpdateError
An Error that occurs when an attempt is made to update a potentially with a selector when that potentially can only be updated strictly.
ModelSelectError
An Error that occurs when an attempt is made to traverse a level of a state tree's hierarchy, but the selected model is not a potentially.
ModelStateError
An Error that occurs when an attempt is made to update an ImmutableModel but the it is in the incorrect state, as required by the update.
ModelStrictUpdateException
An Exception that occurs when a ModelInner is updated with a map that fails a ModelInner.strictUpdates check.
ModelTypeError
An Error that occurs when a model is being updated with a value that does not match the model's ModelType.valueType.
ModelValidationException
An Exception that occurs when a model is updated with an invalid value.