flutter_downloader: Callback must be registered?
If I don’t register any callback, the app will crash on download start with this (same with IOS)
I/flutter ( 5251): Fatal: could not find callback
D/HostConnection( 5251): HostConnection::get() New Host Connection established 0x7b0d1d8e03d0, tid 5368
D/HostConnection( 5251): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0
F/libc ( 5251): FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x7b0c32e178a0)
F/libc ( 5251): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 5309 (1.ui), pid 5251 (asa.workapp.dev)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone_x86_64_arm64/generic_x86_64_arm64:11/RSR1.201211.001.A1/7054069:userdebug/dev-keys'
Revision: '0'
ABI: 'x86_64'
Timestamp: 2021-04-15 19:37:32+0700
pid: 5251, tid: 5309, name: 1.ui >>> com.saritasa.workapp.dev <<<
uid: 10153
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: 'FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x7b0c32e178a0)'
rax 0000000000000000 rbx 0000000000001483 rcx 00007b0f1dea42a8 rdx 0000000000000006
r8 0000000000000000 r9 0000000000000000 r10 00007b0c30c0a540 r11 0000000000000246
r12 0000000000000000 r13 0000000000000018 r14 00007b0c30c0a538 r15 00000000000014bd
rdi 0000000000001483 rsi 00000000000014bd
rbp 00007b0d7d8c0428 rsp 00007b0c30c0a528 rip 00007b0f1dea42a8
Lost connection to device.
But if I do something like this, everything works fine.
FlutterDownloader.registerCallback(TestClass.callback);
class TestClass{
static void callback(String id, DownloadTaskStatus status, int progress) {}
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 18
- Comments: 15
UI is rendered on the main isolate, while download events come from the background isolate (in other words, code in the callback is run in the background isolate), so you have to handle the communication between two isolates
You can do like this
This worked for me.
In the main function, it should be done only once
This how I did it. I just set it during the app initialization
@TheSuperiorStanislav thank you for u support i had found https://pub.dev/packages/flutter_downloader/example the offical site has an exmple to implement download plugin on that i foun we need to add
now the issue over i had used last version