You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final appDocDir = await getApplicationDocumentsDirectory();
// Spawn the isolate and wait for completion
await Isolate.spawn(downloadAudioIsolate, appDocDir.path);
// Continue with your main UI logic
runApp(const MyApp());
}
ERROR:
E/flutter ( 5223): [ERROR:flutter/runtime/dart_isolate.cc(1107)] Unhandled exception:
E/flutter ( 5223): 'package:flutter/src/services/platform_channel.dart': Failed assertion: line 554 pos 7: '_binaryMessenger != null || BindingBase.debugBindingType() != null': Cannot set the method call handler before the binary messenger has been initialized. This happens when you call setMethodCallHandler() before the WidgetsFlutterBinding has been initialized. You can fix this by either calling WidgetsFlutterBinding.ensureInitialized() before this or by passing a custom BinaryMessenger instance to MethodChannel().
E/flutter ( 5223): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/flutter ( 5223): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/flutter ( 5223): #2 MethodChannel.setMethodCallHandler (package:flutter/src/services/platform_channel.dart:554:7)
E/flutter ( 5223): #3 AudioWaveformsInterface.setMethodCallHandler (package:audio_waveforms/src/base/audio_waveforms_interface.dart:196:20)
E/flutter ( 5223): #4 PlatformStreams.init (package:audio_waveforms/src/base/platform_streams.dart:37:44)
E/flutter ( 5223): #5 new PlayerController (package:audio_waveforms/src/controllers/player_controller.dart:81:32)
E/flutter ( 5223): #6 downloadAudioIsolate (package:isolate_demo/main.dart:48:37)
E/flutter ( 5223):
The text was updated successfully, but these errors were encountered:
Hello @SyedZeeshanAijaz, I just want to confirm one thing, If we run the above method downloadAudioIsolate as standalone method(without isolate), does it working for you?
I am trying to fetch the audio from server and extracting waveform from it in background in an isolate to stop the main UI isolate from blocking.
Code:
main->
ERROR:
The text was updated successfully, but these errors were encountered: