flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.17k stars 27.44k forks source link

Flutter Web blank/white screen after hot reload or hot restart #153927

Closed ldsouza93 closed 1 month ago

ldsouza93 commented 2 months ago

Steps to reproduce

When I first run the project the page loads correctly, but after the first hot reload or hot restart I get blank/white page and a console log loop.

Expected results

The page should load on hotreload or hot restart.

Actual results

Blank page with a console output loop

Code sample

pubspec.yaml ```yaml name: wms_main description: A new Flutter project. # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 # followed by an optional build number separated by a +. # Both the version and the builder number may be overridden in flutter # build by specifying --build-name and --build-number, respectively. # In Android, build-name is used as versionName while build-number used as versionCode. # Read more about Android versioning at https://developer.android.com/studio/publish/versioning # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. version: 1.0.0+1 environment: sdk: ^3.5.1 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions # consider running `flutter pub upgrade --major-versions`. Alternatively, # dependencies can be manually updated by changing the version numbers below to # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: xml: ^6.5.0 excel: ^4.0.6 file_picker: ^8.0.3 ota_update: ^6.0.0 flutter_keyboard_visibility: ^6.0.0 printing: ^5.11.0 pdf: ^3.10.8 http: ^1.2.2 pluto_grid_plus: ^8.3.0 universal_html: ^2.2.2 mask_text_input_formatter: ^2.3.0 dio: ^5.1.0 open_file: ^3.3.2 csv: ^6.0.0 shared_preferences: ^2.0.11 intl: ^0.19.0 responsive_sizer: 3.3.1 flutter: sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 dev_dependencies: flutter_test: sdk: flutter # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. flutter_lints: ^4.0.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter packages. flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg assets: - images/ - assets/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware # For details regarding adding assets from package dependencies, see # https://flutter.dev/assets-and-images/#from-packages # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: # fonts: # - family: Schyler # fonts: # - asset: fonts/Schyler-Regular.ttf # - asset: fonts/Schyler-Italic.ttf # style: italic # - family: Trajan Pro # fonts: # - asset: fonts/TrajanPro.ttf # - asset: fonts/TrajanPro_Bold.ttf # weight: 700 # # For details regarding fonts from package dependencies, # see https://flutter.dev/custom-fonts/#from-packages ```

Screenshots or Video

No response

Logs

debug console ```console [ +10 ms] DwdsInjector: Injected debugging metadata for entrypoint at http://localhost:56515/main_module.bootstrap.js [+5762 ms] ChromeProxyService: Initializing expression compiler for main_module.bootstrap.js with sound null safety: true [ +55 ms] ChromeProxyService: Caching package:flutter/src/widgets/widget_inspector.dart in expression compiler worker [ +34 ms] DevHandler: Debug service listening on ws://127.0.0.1:56622/AeNXKVvW5pI=/ws [ +21 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 10, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 10, params: {streamId: Stdout, includePrivateMembers: false}}}} [ +3 ms] This app is linked to the debug service: ws://127.0.0.1:56622/AeNXKVvW5pI=/ws [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 11, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 11, params: {streamId: Stderr, includePrivateMembers: false}}}} [ +9 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 13, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 13, params: {streamId: Isolate, includePrivateMembers: false}}}} [ +4 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 14, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 14, params: {streamId: Extension, includePrivateMembers: false}}}} [ +2 ms] Debug service listening on ws://127.0.0.1:56622/AeNXKVvW5pI=/ws Connecting to VM Service at ws://127.0.0.1:56622/AeNXKVvW5pI=/ws Connected to the VM Service. [ +57 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 18, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 18, params: {streamId: Isolate, includePrivateMembers: false}}}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 19, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 19, params: {streamId: Debug, includePrivateMembers: false}}}} [ +2 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 20, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 20, params: {streamId: Logging, includePrivateMembers: false}}}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 21, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 21, params: {streamId: Extension, includePrivateMembers: false}}}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 22, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 22, params: {streamId: Service, includePrivateMembers: false}}}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 23, error: {code: -32602, message: The stream `ToolEvent` is not supported on web devices}} [ +77 ms] ExpressionEvaluator: Evaluating "() { return true; }" at packages/flutter/src/widgets/unique_widget.dart [ +5 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 28, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +2 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 29, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +2 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 30, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 31, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 32, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 33, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 34, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 35, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +7 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 36, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 37, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 38, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +2 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 39, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 40, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 41, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 42, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 43, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +2 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 44, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 45, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 46, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 47, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 48, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 49, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 50, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 51, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 52, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 53, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 54, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 55, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 56, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +6 ms] ExpressionEvaluator: Evaluating JS: "function () { try { return (function() { const dart_sdk = require('dart_sdk'); const dart_rti = dart_sdk.dart_rti; const dart = dart_sdk.dart; var T = { VoidTobool: () => (T.VoidTobool = dart.constFn(dart_rti.findType("core|bool()")))() }; return dart.fn(() => true, T.VoidTobool()); }( ))(); } catch (error) { return error.name + ": " + error.message; } }" with scope: {} [ +7 ms] ExpressionEvaluator: Evaluated "() { return true; }" to "{type: boolean, value: true}" [ +775 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 66, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 66, params: {streamId: Debug, includePrivateMembers: false}}}} [ +2 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 67, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 67, params: {streamId: Extension, includePrivateMembers: false}}}} [ +2 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 69, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 69, params: {streamId: Isolate, includePrivateMembers: false}}}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 70, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 70, params: {streamId: Logging, includePrivateMembers: false}}}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 71, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 71, params: {streamId: Stderr, includePrivateMembers: false}}}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 72, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 72, params: {streamId: Stdout, includePrivateMembers: false}}}} [ +4 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 75, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 75, params: {streamId: Service, includePrivateMembers: false}}}} [ +177 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 94, error: {code: 106, message: Can only perform operation while paused.}} [ +520 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 112, error: {code: -32602, message: Source report kind Coverage not supported}} [+24636 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 113, error: {code: -32601, message: streamCpuSamplesWithUserTag: Not supported on web devices}} [+3548 ms] Skipping target: gen_localizations [ ] Skipping target: gen_dart_plugin_registrant [ ] Skipping target: _composite [ ] complete [ +78 ms] Scanned through 838 files in 76ms [ +2 ms] <- recompile org-dartlang-app:/web_entrypoint.dart 0e2fda63-00f4-4f08-af15-a455daa94747 [ ] package:wms_main/pages/loginPage/login_page.dart [ ] <- 0e2fda63-00f4-4f08-af15-a455daa94747 [ +224 ms] Synced 0.7MB. [ ] <- accept [ +2 ms] DwdsVmClient: Attempting a hot restart [ ] DwdsVmClient: Attempting to disable breakpoints and resume the isolate [ +2 ms] DwdsVmClient: Successfully disabled breakpoints and resumed the isolate [ ] DwdsVmClient: Attempting to get execution context ID. [ ] DwdsVmClient: Got execution context ID. [ ] DwdsVmClient: Issuing $dartHotRestartDwds request [ +2 ms] ChromeProxyService: Destroying isolate [ ] BatchedExpressionEvaluator: Closed [ +62 ms] ChromeProxyService: Initializing expression compiler for main_module.bootstrap.js with sound null safety: true [ +14 ms] DwdsVmClient: $dartHotRestartDwds request complete. [ ] DwdsVmClient: Waiting for Isolate Start event. [ +17 ms] DwdsVmClient: Successful hot restart [ ] ChromeProxyService: Caching package:flutter/src/widgets/widget_inspector.dart in expression compiler worker [ +8 ms] Restarted application in 411ms. [ +28 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 120, error: {code: -32601, message: Method not found, data: {jsonrpc: 2.0, method: _setStreamIncludePrivateMembers, id: 120, params: {streamId: Isolate, includePrivateMembers: false}}}} [ +28 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 123, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 124, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +2 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 125, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 126, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +5 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 127, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 128, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 129, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 130, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 131, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 132, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 133, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 134, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 135, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 136, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 137, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 138, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 139, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 140, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 141, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 142, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 143, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 144, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 145, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 146, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 147, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 148, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 149, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ ] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 150, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +1 ms] DevHandler: VmService proxy responded with an error: {jsonrpc: 2.0, id: 151, error: {code: -32601, message: setLibraryDebuggable: Not supported on web devices}} [ +122 ms] ExpressionEvaluator: Evaluating "() { return true; }" at packages/flutter/src/widgets/unique_widget.dart [ +17 ms] ExpressionEvaluator: Evaluating JS: "function () { try { return (function() { const dart_sdk = require('dart_sdk'); const dart_rti = dart_sdk.dart_rti; const dart = dart_sdk.dart; var T = { VoidTobool: () => (T.VoidTobool = dart.constFn(dart_rti.findType("core|bool()")))() }; return dart.fn(() => true, T.VoidTobool()); }( ))(); } catch (error) { return error.name + ": " + error.message; } }" with scope: {} [ +1 ms] ExpressionEvaluator: Evaluated "() { return true; }" to "{type: boolean, value: true}" [+4225 ms] A message on the flutter/lifecycle channel was discarded before it could be handled. This happens when a plugin sends messages to the framework side before the framework has had an opportunity to register a listener. See the ChannelBuffers API documentation for details on how to configure the channel to expect more messages, or to expect messages to get discarded: https://api.flutter.dev/flutter/dart-ui/ChannelBuffers-class.html [+1095 ms] A message on the flutter/lifecycle channel was discarded before it could be handled. This happens when a plugin sends messages to the framework side before the framework has had an opportunity to register a listener. See the ChannelBuffers API documentation for details on how to configure the channel to expect more messages, or to expect messages to get discarded: https://api.flutter.dev/flutter/dart-ui/ChannelBuffers-class.html ```

Flutter Doctor output

Doctor output ```console C:\Windows\system32>flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, 3.24.1, on Microsoft Windows [Version 10.0.19045.4780], locale pt-BR) [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.0) [√] Android Studio (version 2024.1) [√] VS Code (version 1.92.2) [√] Connected device (2 available) [√] Network resources ! Doctor found issues in 1 category. ```

edit: after downgrading to flutter version 3.22 its working correctly

joaopinacio commented 2 months ago

Same issue here :c

Lagerstroemia-Indica commented 2 months ago

Hi! @ldsouza93 , I think your debug messages might be indicating that some functions aren't available for use on the web. but if everything was working fine before, would you like to try what I'm suggesting?

Try it Remove pubspec.lock file.

Also, try running the following command in the terminal.

flutter clean
flutter pub get

There are several commands you could try, like selecting stable or running pub cache clean, but I resolved a similar issue using the method I mentioned above.

I really hope this helps fix the problem!

danagbemava-nc commented 2 months ago

Hi @ldsouza93, @joaopinacio do either of you experience this issue with the counter app? If not, could you provide a minimal reproducible code sample so that we can properly investigate this issue?

Thank you

ldsouza93 commented 2 months ago

Hi! @ldsouza93 , I think your debug messages might be indicating that some functions aren't available for use on the web. but if everything was working fine before, would you like to try what I'm suggesting?

Try it Remove pubspec.lock file.

Also, try running the following command in the terminal.

flutter clean
flutter pub get

There are several commands you could try, like selecting stable or running pub cache clean, but I resolved a similar issue using the method I mentioned above.

I really hope this helps fix the problem!

oh wow, just by removing the pubslock.yaml file and running "flutter clean"/"flutter pub get" the hotreload and hotrestart are working again, so far... i'll be working on this project for the day and check if it is stable

thanks!

UPDATE: after reopening vscode and rebuilding the project the problem returned, i'm not sure if it was using 3.24 version when it worked though flutter doctor on the ide console was pointing to it


Hi @ldsouza93, @joaopinacio do either of you experience this issue with the counter app? If not, could you provide a minimal reproducible code sample so that we can properly investigate this issue?

Thank you

on a new project the error doesn't happen, on the loading screen of my app the issue was happening already. my loading page is as follows.

main.dart ```dart import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/services.dart'; import 'package:intl/date_symbol_data_local.dart'; import 'package:intl/intl.dart'; import 'package:responsive_sizer/responsive_sizer.dart'; import 'package:wms_main/functions/constant_values.dart'; import 'dart:math'; import 'package:wms_main/pages/loginPage/login_page.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); initializeDateFormatting('pt_BR'); runApp( ResponsiveSizer(builder: (context, orientation, deviceType) { WidgetsBinding.instance.addPostFrameCallback((_) { Size devicePhysicalSize = View.of(context).physicalSize; baseScale = kIsWeb ? View.of(context).display.devicePixelRatio >= 1.25 ? 1 : 0.2 : 1; if (!kIsWeb) { (devicePhysicalSize.width <= 480 && devicePhysicalSize.height <= 800) ? tela4pol = true : (devicePhysicalSize.width <= 1080 && devicePhysicalSize.height <= 1800) ? tela5pol = true : (devicePhysicalSize.width <= 1080 && devicePhysicalSize.height <= 2028) ? tela546pol = true : (devicePhysicalSize.width <= 1344 && devicePhysicalSize.height <= 2848) ? tela67pol = true : tela4pol = false; } }); return MaterialApp( scrollBehavior: const MaterialScrollBehavior().copyWith( dragDevices: { PointerDeviceKind.mouse, PointerDeviceKind.touch, PointerDeviceKind.stylus, PointerDeviceKind.unknown, }, ), title: 'Home', theme: ThemeData(scaffoldBackgroundColor: Colors.white), home: const LoginPage(), // const Teste(), // const HomePage(), // ); }), ); } class NumberInputFormatter extends TextInputFormatter { final int maxLength; NumberInputFormatter({required this.maxLength}); @override TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) { // Check if length exceeds maxLength if (newValue.text.length > maxLength) { return oldValue; } // Remove all thousand separators and replace decimal separator with a dot String sanitizedText = newValue.text.replaceAll('.', '').replaceAll(',', '.'); // Check if the sanitized text is a valid number if (double.tryParse(sanitizedText) == null) { return oldValue; } double value = double.parse(sanitizedText); int decimalDigits = sanitizedText.contains('.') ? sanitizedText.split('.')[1].length : 0; num divider = pow(10, decimalDigits + 3); NumberFormat formatter = NumberFormat('#,##0.000', 'pt_Br'); String newText = formatter.format(value / divider); return newValue.copyWith(text: newText, selection: TextSelection.collapsed(offset: newText.length)); } } ```
login_page.dart ```dart import 'dart:async'; import 'package:flutter/material.dart'; import 'package:wms_main/functions/constant_values.dart'; import 'package:wms_main/pages/loginPage/login_block.dart'; import 'package:wms_main/pages/loginPage/valida_login.dart'; import 'package:wms_main/widgets/alertDialog/alert_dialog.dart'; import 'package:wms_main/widgets/alertDialog/default_dialog_content.dart'; import 'package:wms_main/widgets/buttons/default_button.dart'; import 'package:wms_main/widgets/header_logo.dart'; import 'package:wms_main/functions/constant_functions.dart'; import 'package:flutter/foundation.dart'; import 'package:responsive_sizer/responsive_sizer.dart'; class LoginPage extends StatefulWidget { const LoginPage({super.key}); @override State createState() => _LoginPageState(); } class _LoginPageState extends State { TextEditingController codEmpresaController = TextEditingController(); TextEditingController userController = TextEditingController(); TextEditingController pwdController = TextEditingController(); FocusNode codEmpresaFocusNode = FocusNode(); FocusNode userFocusNode = FocusNode(); FocusNode pwdFocusNode = FocusNode(); @override void initState() { getCacheString('codEmpresa').then((value) { codEmpresaController.text = value ?? ''; if (value == null) { codEmpresaFocusNode.requestFocus(); } else { userFocusNode.requestFocus(); } }); getCacheBool('novaVersao').then((value) { if (value == true) { alertDialog( isCancelable: false, barrierDismissible: false, insetPadding: EdgeInsets.symmetric(horizontal: 5.w), contentPadding: EdgeInsets.symmetric(horizontal: 2.5.w, vertical: 1.h), context: context, content: const DefaultDialogContent( dialogTitle: 'Aplicativo Atualizado com Sucesso', dialogMessage: 'Corrigido bug na Separação em caso de instabilidade na internet.', ), onPressed: () async => await addCacheBool('novaVersao', false).whenComplete(() => Navigator.pop(context)), ); } }); super.initState(); } @override void dispose() { codEmpresaController.dispose(); userController.dispose(); pwdController.dispose(); codEmpresaFocusNode.dispose(); userFocusNode.dispose(); pwdFocusNode.dispose(); timer!.cancel(); super.dispose(); } @override Widget build(BuildContext context) { return SafeArea( child: Scaffold( backgroundColor: Colors.white, body: Stack( alignment: AlignmentDirectional.center, children: [ Opacity( opacity: 0.7, child: Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage('images/bg.png'), fit: BoxFit.cover, ), ), ), ), Container( width: kIsWeb ? 25.w : 90.w, height: kIsWeb ? 75.h : 92.5.h, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.5), spreadRadius: 2, blurRadius: 3, offset: const Offset(0, 3), ), ], ), child: Column( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ const Expanded(child: HeaderLogo()), LoginBlock( codEmpresaController: codEmpresaController, userController: userController, pwdController: pwdController, codEmpresaFocusNode: codEmpresaFocusNode, userFocusNode: userFocusNode, pwdFocusNode: pwdFocusNode, ), SizedBox(height: 1.5.h), DefaultButton( text: ' Acessar', borderRadius: BorderRadius.zero, textIconButton: true, width: kIsWeb ? 15.5.w : 50.w, height: kIsWeb ? 7.h : (tela4pol || tela546pol || tela67pol) ? 8.h : 7.h, iconSize: kIsWeb ? 15.sp : 22.5.sp, fontSize: kIsWeb ? 15.sp : 22.5.sp, icon: Icons.login, onTap: () async { if (userController.text.isNotEmpty && pwdController.text.isNotEmpty && codEmpresaController.text.isNotEmpty) { await validaLogin( context: context, userPwd: pwdController.text, codEmpr: codEmpresaController.text, userCod: userController.text, ); } else { alertDialog( barrierDismissible: true, context: context, content: const DefaultDialogContent( dialogTitle: 'Alerta!', dialogMessage: 'Existem campos sem preenchimento.', ), ); } }, ), Text( versaoAtual, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15.sp), ), ], ), ), ], ), ), ); } } ```
danagbemava-nc commented 2 months ago

Hi @ldsouza93, do you see any errors in your browser console? What version of flutter was the project created with? Do you have custom loading logic in your index.html?

ashwinv-jain commented 2 months ago

This issue is faced by us as well

danagbemava-nc commented 2 months ago

Hi @ashwinv-jain, do you see any errors in your browser console? What version of flutter was the project created with? Do you have custom loading logic in your index.html? Can you also provide a complete minimal reproducible code sample without any third party packages so that we can properly investigate this?

dipsy commented 1 month ago

same error on clean new project error found on js_promise.dart into futureToPromise:

DartError: Bad state: Cannot add new events after calling close
    at Object.throw_ [as throw] (http://localhost:51236/dart_sdk.js:12007:11)
    at _SyncBroadcastStreamController.new.add (http://localhost:51236/dart_sdk.js:42245:44)
    at _engine.FlutterViewManager.new.registerView (http://localhost:51236/dart_sdk.js:199567:38)
    at Object.ensureImplicitViewInitialized (http://localhost:51236/dart_sdk.js:209883:61)
    at initializeEngineUi (http://localhost:51236/dart_sdk.js:207608:36)
    at initializeEngineUi.next (<anonymous>)
    at runBody (http://localhost:51236/dart_sdk.js:48066:34)
    at Object._async [as async] (http://localhost:51236/dart_sdk.js:48102:7)
    at Object.initializeEngineUi (http://localhost:51236/dart_sdk.js:207597:18)
    at http://localhost:51236/dart_sdk.js:146442:25
    at Generator.next (<anonymous>)
    at runBody (http://localhost:51236/dart_sdk.js:48066:34)
    at Object._async [as async] (http://localhost:51236/dart_sdk.js:48102:7)
    at _engine.AppBootstrap.new.<anonymous> (http://localhost:51236/dart_sdk.js:146438:87)
    at _engine.AppBootstrap.new.<anonymous> (http://localhost:51236/dart_sdk.js:146667:30)
    at Generator.next (<anonymous>)
    at runBody (http://localhost:51236/dart_sdk.js:48066:34)
    at Object._async [as async] (http://localhost:51236/dart_sdk.js:48102:7)
    at http://localhost:51236/dart_sdk.js:146666:85
    at http://localhost:51236/dart_sdk.js:176209:140
    at Object._callDartFunctionFast1 (http://localhost:51236/dart_sdk.js:69539:14)
    at Object.ret [as runApp] (http://localhost:51236/dart_sdk.js:69473:22)
    at http://localhost:51236/flutter_bootstrap.js:1:1204

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.24.2, on macOS 15.0 24A5320a darwin-arm64, locale ru-RU) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 16.0) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.2) [✓] VS Code (version 1.93.0) [✓] Connected device (4 available) [✓] Network resources

• No issues found!

vs code 1.93.0 with flutter extension v3.96.0 chrome 128.0.6613.120

issue not happens if not close Widget Inspector If i close and hot reload: error above

danagbemava-nc commented 1 month ago

Hi @dipsy, is this with the counter app? Can you provide detailed steps to reproduce? A recording would also be very helpful.

Thank you

dipsy commented 1 month ago

first step:

flutter create test_app
Developer identity "Apple Development: ***" selected for iOS code signing
Creating project test_app...
Resolving dependencies in `test_app`... (1.1s)
Downloading packages... 
Got dependencies in `test_app`.
Wrote 129 files.

All done!
You can find general documentation for Flutter at: https://docs.flutter.dev/
Detailed API documentation is available at: https://api.flutter.dev/
If you prefer video documentation, consider: https://www.youtube.com/c/flutterdev

In order to run your application, type:

  $ cd test_app
  $ flutter run

Your application code is in test_app/lib/main.dart.

dima@MacBook-Pro-Dmitrij test-flutter % cd test_app

Test mac app with closing widget inspector:

https://github.com/user-attachments/assets/ab2e1cb7-812d-4574-810c-5b69abfb55ac

Test chrome app with closing widget inspector:

https://github.com/user-attachments/assets/e880e2be-e648-4d86-8358-c522ebf4f9d3

dipsy commented 1 month ago

No problem with chrome app testing without widget inspector closing:

https://github.com/user-attachments/assets/51a4360c-8eed-44c9-a62b-63f786379c84

savioti commented 1 month ago

I'm getting this almost every time I do a hot restart on our web application. Every time I need to manually reload the page after hot restarting it.

It's already the second severe problem I face with 3.24 when building for web.

danagbemava-nc commented 1 month ago

Hi @dipsy, @savioti, can you please check on the master channel to see if you still experience this issue? I was able to reproduce with the steps provided by @dipsy on the stable channel but it seems to work as expected on the master channel

dipsy commented 1 month ago

@danagbemava-nc yea! On master channel (Flutter 3.26.0-1.0.pre.97) no such issue, but I try latest 3.25 and it was

savioti commented 1 month ago

@danagbemava-nc On master channel (3.26.0-1.0.pre.35) it seems to be working fine

In case it helps, here is some stuff that is printed out on my debug console during those restart problems:

Rejecting promise with error: Bad state: Invalid engine initialization state. `initializeEngineServices` was called, but the engine has already started initialization and is currently in state "DebugEngineInitializationState.initializedServices".
Restarted application in 225ms.

Restarted application in 446ms.
A message on the flutter/lifecycle channel was discarded before it could be handled.
This happens when a plugin sends messages to the framework side before the framework has had an opportunity to register a listener. See the ChannelBuffers API documentation for details on how to configure the channel to expect more messages, or to expect messages to get discarded:
  https://api.flutter.dev/flutter/dart-ui/ChannelBuffers-class.html
A message on the flutter/lifecycle channel was discarded before it could be handled.
This happens when a plugin sends messages to the framework side before the framework has had an opportunity to register a listener. See the ChannelBuffers API documentation for details on how to configure the channel to expect more messages, or to expect messages to get discarded:
  https://api.flutter.dev/flutter/dart-ui/ChannelBuffers-class.html
A message on the flutter/lifecycle channel was discarded before it could be handled.
This happens when a plugin sends messages to the framework side before the framework has had an opportunity to register a listener. See the ChannelBuffers API documentation for details on how to configure the channel to expect more messages, or to expect messages to get discarded:
  https://api.flutter.dev/flutter/dart-ui/ChannelBuffers-class.html
A message on the flutter/lifecycle channel was discarded before it could be handled.
This happens when a plugin sends messages to the framework side before the framework has had an opportunity to register a listener. See the ChannelBuffers API documentation for details on how to configure the channel to expect more messages, or to expect messages to get discarded:
  https://api.flutter.dev/flutter/dart-ui/ChannelBuffers-class.html
A message on the flutter/lifecycle channel was discarded before it could be handled.
This happens when a plugin sends messages to the framework side before the framework has had an opportunity to register a listener. See the ChannelBuffers API documentation for details on how to configure the channel to expect more messages, or to expect messages to get discarded:
  https://api.flutter.dev/flutter/dart-ui/ChannelBuffers-class.html
danagbemava-nc commented 1 month ago

Thanks for the confirmation. @savioti, were you using the same steps in the second video in https://github.com/flutter/flutter/issues/153927#issuecomment-2342970906 or were you using a different way to reproduce the issue?

savioti commented 1 month ago

@danagbemava-nc no, maybe I'm talking out of place and I'm sorry if that's the case, but lately, after updating to 3.24, our web application is not automatically reloading the page after a hot reload/restart and needs to be manually reloaded almost every time. I just thought that my problem could be related to this issue.

danagbemava-nc commented 1 month ago

Hi @savioti, that seems like it might be a different issue. Kindly file a new issue if you still experience this on the master channel.

Hi @ldsouza93, can you please confirm if you still experience this issue on the master channel?

dipsy commented 1 month ago

@danagbemava-nc no, maybe I'm talking out of place and I'm sorry if that's the case, but lately, after updating to 3.24, our web application is not automatically reloading the page after a hot reload/restart and needs to be manually reloaded almost every time. I just thought that my problem could be related to this issue.

I think it s same problem, see

ldsouza93 write: edit: after downgrading to flutter version 3.22 its working correctly I am updated before too from 3.22 or 3.23.

github-actions[bot] commented 1 month ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones. Thanks for your contribution.

github-actions[bot] commented 3 weeks ago

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.