react property
It is useful for components whose data view should reactively update when on or more dependent components change their states.
For example, a widget to display the results can depend on the search widget to filter the results.
- key
string
one ofand
,or
,not
defines the combining clause.- and clause implies that the results will be filtered by matches from all of the associated widget states.
- or clause implies that the results will be filtered by matches from at least one of the associated widget states.
- not clause implies that the results will be filtered by an inverse match of the associated widget states.
- value
string or Array or Object
string
is used for specifying a single widget by itsid
.Array
is used for specifying multiple components by theirid
.Object
is used for nesting other key clauses. An example of areact
clause where all three clauses are used and values areObject
,Array
andstring
.
{
'and': {
'or': ['CityComp', 'TopicComp'],
'not': 'BlacklistComp',
},
}
Here, we are specifying that the results should update whenever one of the blacklist items is not present and simultaneously any one of the city or topics matches.
Implementation
/// An example of a `react` clause where all three clauses are used and values are `Object`, `Array` and `string`.
/// ```dart
/// {
/// 'and': {
/// 'or': ['CityComp', 'TopicComp'],
/// 'not': 'BlacklistComp',
/// },
/// }
/// ```
/// Here, we are specifying that the results should update whenever one of the blacklist items is not present and simultaneously any one of the city or topics matches.
final Map<String, dynamic>? react;