react property
read / write
is useful for components whose data view should reactively update when on or more dependent components change their states,
e.g. a component to display the results can depend on the search component 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 component states.
- or clause implies that the results will be filtered by matches from at least one of the associated component states.
- not clause implies that the results will be filtered by an inverse match of the associated component states.
- value
string or Array or Object
string
is used for specifying a single component 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.
Map<String, dynamic> react;