Skip to content

The Flutter DevTools break my app in debug builds #8002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rekire opened this issue Apr 4, 2025 · 1 comment
Open

The Flutter DevTools break my app in debug builds #8002

rekire opened this issue Apr 4, 2025 · 1 comment
Labels
devtools-integration Related to the integration with Dart DevTools topic-debugging

Comments

@rekire
Copy link

rekire commented Apr 4, 2025

Describe the bug
I have an app with a complex initialization which takes around 5 seconds. I am registration a couple of singeltons in getIt. Since the Android Studio plugin pulls the data too early everything breaks for me.

To Reproduce

MultiProvider(
  providers: [
    ChangeNotifierProvider<Example>(
      // normally this method gets invoked after App() is created
      create: (_) => getIt<Example>(), // this crashes and causes also a bug in flutter #166572
    ),
  ],
  child: FutureBuilder(
    future: longRunningInitFuture(),
    builder: (context, snapshot) {
      if (snapshot.connectionState == ConnectionState.done && snapshot.data == true) {
        return const App();
      } else {
        return const SplashScreen();
      }
    },
  ),
)

When I try to consume the Example class like this:

Consumer<Example>(
  builder: (context, example, _) {
    // never called
  }
)

Then I get strange exceptions within the widget tree. See the flutter/flutter#166572 for details.

Expected behavior
I do not expect that the Flutter DevTools Extension collects the data without any interaction from me.

Known workarounds
Disable the extension and enable it only when required after start of the app

Related bugs: flutter/flutter#166572, rrousselGit/provider#908

@pq
Copy link
Contributor

pq commented Apr 9, 2025

/fyi @elliette

@pq pq added devtools-integration Related to the integration with Dart DevTools topic-debugging labels Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devtools-integration Related to the integration with Dart DevTools topic-debugging
Projects
None yet
Development

No branches or pull requests

2 participants