ModelKey<T> class

A ModelKey that holds the data key and provides methods to find and change the data.

Constructors

ModelKey(Symbol key)
Creates a ModelKey.
const

Properties

dataType Type
The compile-time type of the data.
no setter
hashCode int
The hash code for this object.
no setteroverride
key Symbol
The data key.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

change(BuildContext context, T data) → void
Change the data of the model with the given key. Throws an assertion error if the model is read-only.
find(BuildContext context) → T
Find the data of the given type from the context. Throws an assertion error if the data is not found.
findProperty(BuildContext context) ModelProperty<T>
Find the data of the given type from the context. Throws an assertion error if the data is not found.
maybeChange(BuildContext context, T data) → void
Optionally change the data of the model with the given key. Ignores if the model is read-only.
maybeFind(BuildContext context) → T?
Optionally find the data of the given type from the context. Returns null if the data is not found.
maybeFindProperty(BuildContext context) ModelProperty<T>?
Optionally find the property of the given type from the context. Returns null if the data is not found.
maybeOf(BuildContext context) → T?
Optionally find and listen to data changes of the data with the given type from the context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
of(BuildContext context) → T
Find and listen to data changes of the data with the given type from the context.
toString() String
A string representation of this object.
override

Operators

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