Skip to content

Commit 93b1e7f

Browse files
committed
store [nfc]: Pull out _debugLoopWait from poll method
This takes it a bit farther in squeezing out details that aren't part of the main picture of what this method is doing. At this point the main remaining thing that feels like clutter is all the `if (_disposed) return;` lines. But I don't have any ideas at the moment for a better way to handle those.
1 parent 54b39be commit 93b1e7f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/model/store.dart

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -996,17 +996,22 @@ class UpdateMachine {
996996
}());
997997
}
998998

999+
Future<void> _debugLoopWait() async {
1000+
await _debugLoopSignal!.future;
1001+
if (_disposed) return;
1002+
assert(() {
1003+
_debugLoopSignal = Completer();
1004+
return true;
1005+
}());
1006+
}
1007+
9991008
void poll() async {
10001009
assert(!_disposed);
10011010
try {
10021011
while (true) {
10031012
if (_debugLoopSignal != null) {
1004-
await _debugLoopSignal!.future;
1013+
await _debugLoopWait();
10051014
if (_disposed) return;
1006-
assert(() {
1007-
_debugLoopSignal = Completer();
1008-
return true;
1009-
}());
10101015
}
10111016

10121017
final GetEventsResult result;

0 commit comments

Comments
 (0)