Skip to content

Instantly share code, notes, and snippets.

@itsatifsiddiqui
Forked from rrousselGit/event_loop.dart
Created October 14, 2020 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsatifsiddiqui/7134675c97b32a2eac833e6474ad13d2 to your computer and use it in GitHub Desktop.
Save itsatifsiddiqui/7134675c97b32a2eac833e6474ad13d2 to your computer and use it in GitHub Desktop.
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
Future<void> asyncFunction() async {
print('a');
await Future.value();
print('b');
}
Stream<void> asyncGenerator() async* {
print('c');
}
void main() {
runApp(Container());
asyncFunction();
asyncGenerator().listen((_) {});
WidgetsBinding.instance.addPostFrameCallback((_) => print('d'));
Future(() => print('e'));
Future(() {}).then((_) => print('f'));
Future.sync(() => print('g'));
Future.sync(() {}).then((_) => print('h'));
Future.value().then((_) => print('i'));
Future.microtask(() => print('j'));
Future.microtask(() {}).then((_) => print('k'));
WidgetsBinding.instance.addPostFrameCallback((_) => print('l'));
print('m');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment