DesignField class
Provide a viewer data builder parameter for the field (be it a class field, or a method/ctor parameter field).
The designer will use the first data builder in the provided list which contains the same parameter type.
Some of the data builder takes an "initial value" of the field.
This is especially useful for required
fields that has no default value on the constructor. If both
the initial value and the default value is specified, the parameter
will be used.
Example: used on a ctor field, will take priority if @DesignField is also provided on the class field.
class Avatar extends StatelessWidget { final String uri;
const Avatar({ @DesignField(parameter: 'https://images.unsplash.com/photo-1529778873920-4da4926a72c2') required this.uri, this.radius = 30.0, Key? key, }) : super(key: key); }
Example: used on a class field
class Avatar extends StatelessWidget { @DesignField(parameter: 'https://images.unsplash.com/photo-1529778873920-4da4926a72c2') final String uri;
const Avatar({ required this.uri, this.radius = 30.0, Key? key, }) : super(key: key); }
Constructors
- DesignField({dynamic parameter})
-
Default constructor
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- parameter → dynamic
-
The initial parameter of the initial data builder to be used by the viewer.
The designer will use the first data builder in the provided list which contains
the same parameter type.
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