Closed chi-tea-72 closed 4 years ago
Fixed in Pull Request #371 :
closeRecorder
is supposed to always work without throwing any exception.
This verb was not correctly protected on Android.
Thank you @Larpoux! When can we expect it to be merged to master?
Is that branch better ?
Ok I'll try it out and let you know asap
Hi @Larpoux, I just pulled in that branch and tested it, it doesn't throw an exception anymore, so looks good to me!
Do you think it's better to call it in dispose() or before dispose happens. I tested it in both cases and it worked fine, but is there a preferred location to call it from, or does it not matter?
It does not matter. Probably during dispose() is convenient.
Somebody kenows when will be this fix publicated in https://pub.dev/??? Thanks a lot.
I am currently working on FS 5.1.0 .
I hope to publish it later this week.
The method 'closeAudioSession' isn't defined for the type 'FlutterSoundRecorder'. Try correcting the name to the name of an existing method, or defining a method named 'closeAudioSession'.dartundefined_method Type: InvalidType
Because flutter_sound >=9.8.1 depends on flutter_sound_web 9.8.1 which depends on js ^0.7.1, flutter_sound >=9.8.1 requires js ^0.7.1. Because flutter_secure_storage_web 1.2.1 depends on js ^0.6.3 and no versions of flutter_secure_storage_web match >1.2.1 <2.0.0, flutter_secure_storage_web ^1.2.1 requires js ^0.6.3. Thus, flutter_sound >=9.8.1 is incompatible with flutter_secure_storage_web ^1.2.1. And because flutter_secure_storage 9.2.2 depends on flutter_secure_storage_web ^1.2.1 and no versions of flutter_secure_storage match >9.2.2 <10.0.0, flutter_sound >=9.8.1 is incompatible with flutter_secure_storage ^9.2.2. So, because customer_app depends on both flutter_secure_storage ^9.2.2 and flutter_sound ^9.8.1, version solving failed.
@Teka-coder : it seems that flutter_secure_storage_web 1.2.1 depends on js ^0.6.3, which is an old version of JS. I would not like to have to downgrade Flutter Sound to be compatible with this JS version, because others Flutter Sound users could complain that our plugin uses a too old JS version.
It would be better if flutter_secure_storage_web
uses a more recent version of JS.
What can we do ? What do you suggest ?
Flutter Secure Storage Web 2.0.0-beta-1 does not depend anymore on JS. Maybe you can consider using this version of Secure Storage Web ?
Flutter Sound Version :
Released or Beta version ? Released
Version number ? 5.0.1
FULL or LITE flavor ? LITE
Result of the command "flutter pub deps | grep flutter_sound" (important)
Severity
Halts code execution. Unable to get past the following line in my code to execute code afterwards:
await _audioRecorder.closeAudioSession();
Platforms you faced the error
A real android device.
Logs
(This is very important. Most of the time we cannot do anything if we do not have information on your bug)
E/MethodChannel#com.dooboolab.flutter_sound_recorder(24648): Failed to handle method call E/MethodChannel#com.dooboolab.flutter_sound_recorder(24648): java.lang.NullPointerException: Attempt to invoke interface method 'void com.dooboolab.fluttersound.RecorderInterface._stopRecorder()' on a null object reference
From the stack trace we start here: https://github.com/dooboolab/flutter_sound/blob/master/lib/src/flutter_sound_recorder.dart#L144 Finally the crash occurs here: https://github.com/dooboolab/flutter_sound/blob/master/lib/src/session.dart#L51
Describe the bug A clear and concise description of what the bug is. Calling
await recorder.closeAudioSession()
triggers a Platform exception to be thrown. The exception isvoid com.dooboolab.fluttersound.RecorderInterface._stopRecorder()' on a null object reference
. This happens even when I move the method call to dispose().Expected behavior A clear and concise description of what you expected to happen. I expect calling
await recorder.closeAudioSession()
to simply clean up the audio resources, and not throw an exception.