nc-photos/lib/async_util.dart

11 lines
233 B
Dart
Raw Normal View History

2021-11-19 14:46:07 +01:00
import 'dart:async';
Future<void> wait(
FutureOr<bool> Function() condition, {
Duration? pollInterval,
}) async {
while (!await condition()) {
await Future.delayed(pollInterval ?? const Duration(milliseconds: 500));
}
}