Upgrade to flutter_rust_bridge V2

This commit is contained in:
2024-02-06 20:19:53 +08:00
parent 55f5bac8d9
commit a6c9b46100
46 changed files with 2121 additions and 1213 deletions

View File

@ -0,0 +1,11 @@
use std::sync::Arc;
use crate::downloader::{do_cancel_download, do_start_download, DownloadCallbackData};
use crate::frb_generated::StreamSink;
pub fn start_download(url: String, save_path: String, file_name: String, connection_count: u8, sink: StreamSink<DownloadCallbackData>) {
let _ = do_start_download(url, save_path, file_name, connection_count, Arc::new(sink));
}
pub async fn cancel_download(id: String) {
do_cancel_download(&id).await
}

5
rust/src/api/mod.rs Normal file
View File

@ -0,0 +1,5 @@
//
// Do not put code in `mod.rs`, but put in e.g. `simple.rs`.
//
pub mod downloader_api;