RefreshStreamMixin mixin
A mixin that provides a stream of update events.
This mixin is used to notify listeners when an update occurs. It is used in the RefreshStreamMixin class.
Example:
class MyRepository with RefreshNotifierMixin {
void create() {
// Execute create logic
refreshListeners(RefreshType.create);
}
void update() {
// Execute update logic
refreshListeners(RefreshType.update);
}
}
Then you can listen to the refresh stream like this:
myRepository.listen((event) {
switch (event) {
case RefreshType.create:
// Execute create logic
break;
case RefreshType.update:
// Execute update logic
break;
}
});
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> - Closes the refresh stream.
-
listen(
void events(RefreshType event)) → StreamSubscription< RefreshType> - Listener function for the refresh stream.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refreshListeners(
RefreshType event) → void - Adds a new refresh event to the stream.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited