SearchStateController class
It allows you to access the current state of your widgets along with the search results. For instance, you can use this class to access the previous and the next(latest) state of your app widget tree.
Examples Use(s):
- perform side-effects based on the results states of various widgets.
For example,
SearchStateController(
subscribeTo: {
'author-filter': [KeysToSubscribe.Value]
},
onChange: (next, prev) {
print("Next state");
print(next['author-filter']?.value;
print("Prev state");
print(prev['author-filter']?.value);
},
searchBase: searchBaseInstance,
)
```dart
Constructors
-
SearchStateController({Map<
String, List< ? subscribeTo, void onChange(Map<KeysToSubscribe> >String, SearchControllerState> , Map<String, SearchControllerState> )?, required SearchBase searchBase})
Properties
-
current
→ Map<
String, SearchControllerState> -
It holds the current state of the subscribed widgets.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onChange
→ void Function(Map<
String, SearchControllerState> , Map<String, SearchControllerState> )? -
Callback function, is a callback function called when the search state changes
and accepts the previous and next search state as arguments.
For example,
final
-
previous
→ Map<
String, SearchControllerState> -
It holds the just-previous state of the subscribed widgets.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchBase → SearchBase
-
It is the reference to the SearchBase instance of the app.
final
-
subscribeTo
→ Map<
String, List< ?KeysToSubscribe> > -
A map of widget ids and list of properties to subscribe to.
final
Methods
-
dispose(
) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
subscribeToProperties(
) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited