PropsMeta class
Metadata for the prop fields declared in a specific props class--
a class annotated with @Props
, @PropsMixin
, @AbstractProps
, etc.
for which prop accessors are generated.
This metadata includes map key values corresponding to these fields, which
is used in consumedPropKeys
, as well as other prop
configuration done via @Accessor
/@requiredProp
/etc., which is used to
perform prop validation within UiComponent
lifecycle methods.
This metadata is generated as part of the over_react builder, and should be exposed like so: @Props() class FooProps { static const PropsMeta meta = _$metaForFooProps;
String foo;
@Accessor(isRequired: true, key: 'custom_key', keyNamespace: 'custom_namespace')
int bar;
}
What the metadata looks like:
main() {
print(FooProps.meta.keys); // FooProps.foo, custom_namespace.custom_key
print(FooProps.meta.props.map((p) => p.isRequired); // (false, true))
}
See also: getPropKey
- Implemented types
- Implementers
Constructors
-
PropsMeta({required List<
PropDescriptor> fields, required List<String> keys}) -
const
- PropsMeta.forSimpleKey(String key)
-
A convenience constructor to make a metadata object for a single key.
factory
Properties
-
fields
→ List<
PropDescriptor> -
Rich views of prop field declarations.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
keys
→ List<
String> -
Top-level accessor of string keys of props stored in fields.
final
-
props
→ List<
PropDescriptor> -
Rich views of prop declarations.
no setteroverride
- 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.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited