Closed daniloapr closed 1 month ago
Hi @daniloapr, thanks for your findings!
I did some tests and figured out that there was a problem when doing a hot reload restart. This is a complete minimal example done with your code:
A side note on the code:
player.init();
to catch error and to be sure all gone well. For example if you call init()
just after instanting for the first time SoLoudImpl
, it will not work.dispose()
you'd better call deinit()
instead disposeAllSources()
(just by intuition from the method name).I did a change in the plugin. Can you please try it and tell me if it works for you? You can try by replacing
dependencies:
flutter_soloud: ^2.0.0
with
dependencies:
flutter_soloud:
git:
url: https://github.com/alnitak/flutter_soloud.git
ref: dev
Hey, I had the same initializing error and with your new version it worked :)! Thanks for the fast fix!
I have pushed version 2.0.1 with the fix for this issue. Also, thanks @novas1r1 for the feedback.
Description
I'm instantiating the
SoLoud.instance
in a singleton class and callinginit()
when the singleton's constructor. When I hot reload the application, it throws aSoLoudPlayerAlreadyInitializedException
(logs below). However, when I try to load assets, it throws the exceptionSoLoudNotInitializedException
. This is preventing me from using the library.Steps To Reproduce
SoLoud.instance.init()
Expected Behavior
The previous instance should be refreshed and no init() error should occur
Logs
Code