File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,15 @@ class SharedValue<T> {
126
126
}
127
127
}
128
128
129
+ Future <void > waitUntil (bool Function (T ) predicate) async {
130
+ // short-circuit if predicate already satisfied
131
+ if (predicate (value)) return ;
132
+ // otherwise, run predicate on every change
133
+ await for (T value in this .stream) {
134
+ if (predicate (value)) break ;
135
+ }
136
+ }
137
+
129
138
/// Try to load the value stored at [key] in shared preferences.
130
139
/// If no value is found, return immediately.
131
140
/// Else, udpdate [value] and rebuild dependent widgets if it changed.
Original file line number Diff line number Diff line change 1
1
name : shared_value
2
2
description : A straightforward way to manage global state in flutter apps.
3
- version : 0.3.3
3
+ version : 0.4.0
4
4
author :
Dev Aggarwal <[email protected] >
5
5
homepage : https://github.com/pycampers/flutter-global-state
6
6
You can’t perform that action at this time.
0 commit comments