StateMeta class
Metadata for the state fields declared in a specific state class--
a class annotated with @State
, @StateMixin
, @AbstractState
, etc.
for which state accessors are generated.
This metadata includes map key values corresponding to these fields, which
is used to perform state validation within UiComponent
lifecycle methods.
This metadata is generated as part of the over_react builder, and should be exposed like so: @State() class FooState { static const StateMeta meta = _$metaForFooState;
String foo;
@Accessor(key: 'custom_key', keyNamespace: 'custom_namespace')
int bar;
}
What the metadata looks like:
main() {
print(FooState.meta.keys); // FooState.foo, custom_namespace.custom_key
print(FooState.meta.fields.map((s) => s.key); // FooState.foo, custom_namespace.custom_key
}
- Implemented types
Constructors
-
StateMeta({required List<
StateDescriptor> fields, required List<String> keys}) -
const
Properties
-
fields
→ List<
StateDescriptor> -
Rich views of state field declarations.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
keys
→ List<
String> -
Top-level accessor of string keys of state stored in fields.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited