diff --git a/flutter_ffi_plugin/bin/src/message.dart b/flutter_ffi_plugin/bin/src/message.dart index e99fcfd3..1b98a24b 100644 --- a/flutter_ffi_plugin/bin/src/message.dart +++ b/flutter_ffi_plugin/bin/src/message.dart @@ -418,7 +418,7 @@ use std::sync::OnceLock; use tokio::sync::mpsc::unbounded_channel; type SignalHandlers = OnceLock< - HashMap) + HashMap Result<(), Box> + Send + Sync>>, >; static SIGNAL_HANDLERS: SignalHandlers = OnceLock::new(); @@ -426,12 +426,12 @@ static SIGNAL_HANDLERS: SignalHandlers = OnceLock::new(); pub fn handle_dart_signal( message_id: i32, message_bytes: &[u8], - binary: Vec + binary: &[u8] ) { let hash_map = SIGNAL_HANDLERS.get_or_init(|| { let mut new_hash_map = HashMap::< i32, - Box) + Box Result<(), Box> + Send + Sync>, >::new(); '''; @@ -452,14 +452,14 @@ pub fn handle_dart_signal( rustReceiveScript += ''' new_hash_map.insert( ${markedMessage.id}, - Box::new(|message_bytes: &[u8], binary: Vec| { + Box::new(|message_bytes: &[u8], binary: &[u8]| { use super::$modulePath$filename::*; let message = ${normalizePascal(messageName)}::decode( message_bytes )?; let dart_signal = DartSignal { message, - binary, + binary: binary.to_vec(), }; let mut guard = ${snakeName.toUpperCase()}_CHANNEL.lock()?; if guard.is_none() {