Model<T> class
A widget that provides the model to its descendants.
- Inheritance
- Mixed-in types
- Implementers
Constructors
-
Model(Symbol dataKey, T value, {ValueChanged<
T> ? onChanged}) -
Creates a Model for MultiModel.
const
-
Model.inherit(Symbol dataKey, T value, {Key? key, ValueChanged<
T> ? onChanged, required Widget? child}) -
Creates a single Model widget.
const
Properties
- child → Widget?
-
The child widget.
final
- dataKey → Symbol
-
The data key of the model.
final
- dataType → Type
-
The data type of the model.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isReadOnly → bool
-
Whether the model is read-only.
no setteroverride
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
modelKey
→ ModelKey<
T> -
The model key of the model.
no setterinherited
-
normalized
→ Model<
T> -
The normalized model of the model.
no setteroverride
-
onChanged
→ ValueChanged<
T> ? -
The callback when the data changes.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ T
-
The data value of the model.
finalgetter/setter pairoverride
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
change<
T> (BuildContext context, Symbol key, T data) → void - Change the data of the model with the given key. Throws an assertion error if the model is read-only.
-
find<
T> (BuildContext context, Symbol key) → T - Find the data of the given type from the context. Throws an assertion error if the data is not found.
-
findProperty<
T> (BuildContext context, Symbol key) → ModelProperty< T> - Find the property of the given type from the context. Throws an assertion error if the data is not found.
-
maybeChange<
T> (BuildContext context, Symbol key, T data) → bool - Optionally change the data of the model with the given key. Ignores if the model is read-only.
-
maybeFind<
T> (BuildContext context, Symbol key) → T? - Optionally find the data of the given type from the context. Returns null if the data is not found.
-
maybeFindProperty<
T> (BuildContext context, Symbol key) → ModelProperty< T> ? - Optionally find the property of the given type from the context. Returns null if the data is not found.
-
maybeOf<
T> (BuildContext context, Symbol key) → T? - Optionally find and listen to data changes of the data with the given type from the context.
-
maybeOfProperty<
T> (BuildContext context, Symbol key) → ModelProperty< T> ? - Optionally find and listen to property changes of the data with the given type from the context. Returns null if the data is not found.
-
of<
T> (BuildContext context, Symbol key) → T - Find and listen to data changes of the data with the given type from the context.
-
ofProperty<
T> (BuildContext context, Symbol key) → ModelProperty< T> - Find and listen to property changes of the data with the given type from the context. Throws an assertion error if the data is not found.