Minimal Flame example throws Exception in Flutter Web with message "Trying to render a disposed EngineFlutterView." (to reproduce see below). Tested with Flame 1.20 and 1.19 / Flutter 3.24.3 / VSCode on Mac with Chrome
No exception thrown
Flutter -> New Project -> Empty Application
Select Chrome / Web
Run / Debug
Open Javascript console
Restart (try a few times)
--> Exception is not thrown
In Terminal flutter pub add flame
replace contents of main.dart with
import 'package:flame/game.dart';
import 'package:flutter/widgets.dart';
void main() {
final game = FlameGame();
runApp(GameWidget(game: game));
}
(same as https://docs.flame-engine.org/latest/tutorials/bare_flame_game.html)
Hmmmmmmmmmmmmm
see above
this error does not occur in the zap.run environment which does not implement restart
βββ‘ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
js_primitives.dart:28 The following assertion was thrown during a scheduler callback:
js_primitives.dart:28 Assertion failed: org-dartlang-sdk:///lib/_engine/engine/window.dart:102:12
js_primitives.dart:28 !isDisposed
js_primitives.dart:28 "Trying to render a disposed EngineFlutterView."
js_primitives.dart:28
js_primitives.dart:28 When the exception was thrown, this was the stack:
js_primitives.dart:28 dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 296:3 throw_
js_primitives.dart:28 dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3 assertFailed
js_primitives.dart:28 lib/_engine/engine/window.dart 102:13 render
js_primitives.dart:28 packages/flutter/src/rendering/view.dart 353:7 compositeFrame
js_primitives.dart:28 packages/flutter/src/rendering/binding.dart 607:19 drawFrame
js_primitives.dart:28 packages/flutter/src/widgets/binding.dart 1164:13 drawFrame
js_primitives.dart:28 packages/flutter/src/rendering/binding.dart 468:5 [_handlePersistentFrameCallback]
js_primitives.dart:28 packages/flutter/src/scheduler/binding.dart 1397:7 [_invokeFrameCallback]
js_primitives.dart:28 packages/flutter/src/scheduler/binding.dart 1318:9 handleDrawFrame
js_primitives.dart:28 packages/flutter/src/scheduler/binding.dart 1176:5 [_handleDrawFrame]
js_primitives.dart:28 lib/_engine/engine/platform_dispatcher.dart 1408:5 invoke
js_primitives.dart:28 lib/_engine/engine/platform_dispatcher.dart 310:5 invokeOnDrawFrame
js_primitives.dart:28 lib/_engine/engine/initialization.dart 187:36 <fn>
js_primitives.dart:28 dart-sdk/lib/_internal/js_dev_runtime/patch/js_allow_interop_patch.dart 188:27 _callDartFunctionFast1
Output of: flutter doctor -v
[β] Flutter (Channel stable, 3.24.3, on macOS 15.0.1 24A348 darwin-x64, locale
en-GB)
β’ Flutter version 3.24.3 on channel stable at
/Users/m/root/dev/flutter/flutter
β’ Upstream repository https://github.com/flutter/flutter.git
β’ Framework revision 2663184aa7 (5 weeks ago), 2024-09-11 16:27:48 -0500
β’ Engine revision 36335019a8
β’ Dart version 3.5.3
β’ DevTools version 2.37.3
[β] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
β’ Android SDK at /Users/m/Library/Android/sdk
β’ Platform android-34, build-tools 35.0.0
β’ Java binary at: /Applications/Android
Studio.app/Contents/jbr/Contents/Home/bin/java
β’ Java version OpenJDK Runtime Environment (build
17.0.11+0-17.0.11b1207.24-11852314)
β’ All Android licenses accepted.
[β] Xcode - develop for iOS and macOS (Xcode 16.0)
β’ Xcode at /Applications/Xcode.app/Contents/Developer
β’ Build 16A242d
β’ CocoaPods version 1.15.2
[β] Chrome - develop for the web
β’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[β] Android Studio (version 2024.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
17.0.11+0-17.0.11b1207.24-11852314)
[β] VS Code (version 1.94.2)
β’ VS Code at /Applications/Visual Studio Code.app/Contents
β’ Flutter extension version 3.98.0
[β] Connected device (2 available)
β’ macOS (desktop) β’ macos β’ darwin-x64 β’ macOS
15.0.1 24A348 darwin-x64
β’ Chrome (web) β’ chrome β’ web-javascript β’ Google
Chrome 129.0.6668.101
! Device emulator-5562 is offline.
[β] Network resources
β’ All expected network resources are available.
Web
Haven't seen this before
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too