Skip to content

Instantly share code, notes, and snippets.

@tejainece
Created October 21, 2024 12:57
Show Gist options
  • Save tejainece/423385a87c4499d49c0b625d0f89bc34 to your computer and use it in GitHub Desktop.
Save tejainece/423385a87c4499d49c0b625d0f89bc34 to your computer and use it in GitHub Desktop.
Does waiting the same future multiple times succeed and give same value?
import 'dart:async';
Future<void> main() async {
final completer = Completer<bool>();
final future = completer.future;
completer.complete(true);
print(await future);
print(await future);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment