Skip to content

[web] Can't run a Flutter web app when there are async operations before runApp/runZoned #50977

Closed

Description

@jorgecoca

Steps to Reproduce

This code does not work (leaves a white empty screen on the browser, and there are no errors reported or anything):

Future<void> main() => runMyApp();

Future<void> runMyApp() async {
  final authenticationRepository = await AuthenticationRepository.create();
  await runZoned(
    () async => runApp(
      MaterialApp(home: Text('hey 2')),
    ),
  );
}

However, this code works:

Future<void> main() => runMyApp();

Future<void> runMyApp() async {
  await runZoned(
    () async => runApp(
      MaterialApp(home: Text('hey 2')),
    ),
  );
}

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.14.6, on Mac OS X 10.15.3 19D76, locale en-US)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 3.6)
[✓] VS Code (version 1.42.1)
[✓] Connected device (3 available)

• No issues found!

Activity

  1. jorgecoca commented on Feb 18, 2020

    @jorgecoca
    ContributorAuthor

    After some investigation, this is an issue on Hive and path_provider

  2. github-actions commented on Aug 23, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  3. locked as resolved and limited conversation to collaborators on Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions