Skip to content

Instantly share code, notes, and snippets.

@ruan65
Last active October 5, 2021 12:39
Show Gist options
  • Select an option

  • Save ruan65/9f41e69cba9d804c76081b76f3148381 to your computer and use it in GitHub Desktop.

Select an option

Save ruan65/9f41e69cba9d804c76081b76f3148381 to your computer and use it in GitHub Desktop.

Revisions

  1. ruan65 revised this gist Oct 5, 2021. 1 changed file with 10 additions and 2 deletions.
    12 changes: 10 additions & 2 deletions await_vs_then.dart
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,12 @@
    Future.delayed(Duration(seconds: 1)).then((_) {
    void main() async {

    Future.delayed(Duration(milliseconds: 500)).then((_) {
    print('hi');
    });
    print('hello');
    print('hello');

    await Future.delayed(Duration(milliseconds: 1000));
    print('hi');

    print('hello');
    }
  2. ruan65 created this gist Oct 5, 2021.
    4 changes: 4 additions & 0 deletions await_vs_then.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    Future.delayed(Duration(seconds: 1)).then((_) {
    print('hi');
    });
    print('hello');