Open premiumbiscuit opened 2 weeks ago
@premiumbiscuit You are using flutter_bloc
which is community package. In order to properly address the issue, please narrow down the code sample to minimal but complete and without community package implementation, that still triggers the reported exception.
Thanks @darshankawar for looking into this. I have replaced flutter_bloc
with a StreamController, please see the code below. Ultimately, anything that causes re-rendering will produce the bug for some reason.
Thanks for the update. Using above code sample, it throws below error log in the console:
Thank you for the report. To debug this it would help if you could reduce the test case more, see https://github.com/flutter/flutter/wiki/Issue-hygiene#provide-reduced-test-cases
I tried to come up with reduced repro code as below without go_router implementation but it is giving me different error, so probably @premiumbiscuit please try to narrow down the code to bare minimum that still triggers the reported error.
Steps to reproduce
I have attached a sample code to reproduce the bug. Click the "crash me!" button twice. This issue seems to disappear when the layout builder is removed.
Expected results
The counter should increment without any crashes.
Actual results
A crash occurs.
Code sample
Code sample
```dart import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; final GlobalKeyPubspec
```yaml name: go_router_bug description: "A new Flutter project." # Prevent accidental publishing to pub.dev. publish_to: 'none' version: 1.0.0+1 environment: sdk: '>=3.3.4 <4.0.0' dependencies: go_router: ^14.0.0 flutter_bloc: ^8.1.5 flutter: sdk: flutter flutter_localizations: sdk: flutter dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^3.0.0 flutter: uses-material-design: true # Enable generation of localized Strings from arb files. generate: true assets: # Add assets from the images directory to the application. - assets/images/ ```Screenshots or Video
Screenshots / Video demonstration
[Upload media here]Logs
Logs
```console ======== Exception caught by widgets library ======================================================= The following assertion was thrown building RootScreen(dependencies: [_InheritedProviderScopeFlutter Doctor output
Doctor output
```console flutter doctor -v [✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-x64, locale en-AU) • Flutter version 3.19.6 on channel stable at /Applications/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 54e66469a9 (9 days ago), 2024-04-17 13:08:03 -0700 • Engine revision c4cd48e186 • Dart version 3.3.4 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/shady/Library/Android/sdk • Platform android-33, build-tools 32.1.0-rc1 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C500b • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822) [✓] IntelliJ IDEA Ultimate Edition (version 2024.1) • IntelliJ at /Users/shady/Applications/IntelliJ IDEA Ultimate.app • Flutter plugin version 79.0.3 • Dart plugin version 241.15845 [✓] VS Code (version 1.88.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] VS Code (version 1.86.0-insider) • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (4 available) • Shady’s Shenanigans (mobile) • 00008110-001129523C09801E • ios • iOS 17.4.1 21E236 • iPad Pro (12.9-inch) (6th generation) (mobile) • 71A2390D-33E0-40A6-965A-17475C5A5527 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator) • macOS (desktop) • macos • darwin-x64 • macOS 14.4.1 23E224 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 124.0.6367.91 [✓] Network resources • All expected network resources are available. • No issues found! ```