nc-photos/app/lib/async_util.dart
2022-04-06 02:37:58 +08:00

10 lines
233 B
Dart

import 'dart:async';
Future<void> wait(
FutureOr<bool> Function() condition, {
Duration? pollInterval,
}) async {
while (!await condition()) {
await Future.delayed(pollInterval ?? const Duration(milliseconds: 500));
}
}