Prop class

This is an object used in denoting prop variables passed as arguments in a pheasant component.

This annotation object is used to denote variables that may not be initialised in the script part of the component, and represent data passed from the parent component encapsulating the component to the child. This allows dynamic data to be bound and passed from the parent to the child component.

In every Prop object, there are two variables: the defaultTo, which represents the default value of the prop if not passed through the child component, the optional value, which denotes whether the prop is optional or not.

@Prop(defaultTo: 9, optional: true)
int myNum;

The following variable is processed and then the constructor of the compiled pheasant object is converted into

AppComponent({super.template, this.myNum = 9});

Whenever this object is passed, if optional is set to true, then a defaultTo must be passed.

By defualt, any uninitialised variables without the @Prop() annotation has no default value, and optional is set to false.

None of the variables are required, and all are optional. If you do not want to use such, and want to go to default settings, then you can use the ordinary @prop object.

Constructors

Prop({dynamic defaultTo, bool optional = false})
const

Properties

defaultTo → dynamic
final
hashCode int
The hash code for this object.
no setterinherited
info String
The info portrayed by the object
finalinherited
optional bool
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