aria2_plugin

The flutter aria2 downloader based on aria2_ws (rust) supports all platforms of Android, iOS, macOS, Windows, Linux and Web

Getting Started

development environment:flutter:3.19.3

cd example && flutter clean
flutter run

Api

1.Connection

address: aria2 connection address, example:ws://127.0.0.1:6800/jsonrpc

await Aria2Plugin().connect(address);

2.Add download task

urls: remote download link

await Aria2Plugin().addTask([...urls]);

3.Listen for task callbacks

Aria2Plugin().addListen(listen: (MyNotification value){
  value.when(aria2: (gid, event) {
    //todo aria2 event callback
  }, webSocketConnected: () {
    //todo connected
  }, websocketClosed: () {
    //todo closed
  });
  // or value.whenOrNull();
});

4.Get task details

gid: Task ID, returned from aria 2

Aria2Plugin().getInfo(gid).then((AriaDetail? r) {
    if (r != null) {
       infos[key] = r;
    }
});
  1. Disconnect and release memory
Client? client;
...
client?.dispose(); 

For more usage methods, please refer to the example directory

Related Links