Closed sumanthratna closed 3 years ago
here's a simple flame game:
class MyGame extends BaseGame { Future<void> onLoad() async { super.onLoad(); FlameAudio.bgm.initialize(); FlameAudio.bgm.play('music/background.mp3', volume: 0.75); } } void main() { final BaseGame myGame = MyGame(); runApp( GameWidget( game: myGame, ), ); }
when I start the app with flutter run and then type R in the terminal to hot restart, I get this error:
flutter run
E/flutter (17559): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: LateInitializationError: Field '_channel@669020947' has been assigned during initialization. E/flutter (17559): #0 AudioPlayer._channel (package:audioplayers/audioplayers.dart) E/flutter (17559): #1 AudioPlayer._invokeMethod (package:audioplayers/audioplayers.dart:283:12) E/flutter (17559): #2 AudioPlayer.setReleaseMode (package:audioplayers/audioplayers.dart:469:12) E/flutter (17559): #3 AudioCache.loop (package:audioplayers/audio_cache.dart:178:12) E/flutter (17559): <asynchronous suspension> E/flutter (17559): #4 Bgm.play (package:flame_audio/bgm.dart:57:19) E/flutter (17559): <asynchronous suspension> E/flutter (17559):
and the music stops
flutter doctor -v:
flutter doctor -v
[✓] Flutter (Channel stable, 2.0.5, on macOS 11.3 20E5196f darwin-x64, locale en-US) • Flutter version 2.0.5 at /Users/suman/flutter • Framework revision adc687823a (13 days ago), 2021-04-16 09:40:20 -0700 • Engine revision b09f014e96 • Dart version 2.12.3 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/suman/Library/Android/sdk/ • Platform android-30, build-tools 30.0.3 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.4, Build version 12D4e • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.55.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.21.0 [✓] Connected device (3 available) • Z3351S (mobile) • 320295556323 • android-arm • Android 9 (API 28) • macOS (desktop) • macos • darwin-x64 • macOS 11.3 20E5196f darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.93 ! Error: Sumanth Ratna is not connected. Xcode will continue when Sumanth Ratna is connected. (code -13) • No issues found!
Hi! This package was migrate to the main flame monorepo. If this issue still persists with the current version, please re-open on that repo so we can keep track of it!
Sorry for the inconvenience.
The Issue
here's a simple flame game:
when I start the app with
flutter run
and then type R in the terminal to hot restart, I get this error:and the music stops
Environment
flutter doctor -v
: