2023-11-04 22:55:48 +08:00
|
|
|
// AUTO GENERATED FILE, DO NOT EDIT.
|
|
|
|
// Generated by `flutter_rust_bridge`@ 1.82.3.
|
|
|
|
// ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, unnecessary_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names, invalid_use_of_internal_member, prefer_is_empty, unnecessary_const
|
|
|
|
|
|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:async';
|
|
|
|
import 'package:meta/meta.dart';
|
|
|
|
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
|
|
|
|
import 'package:uuid/uuid.dart';
|
2023-11-05 15:56:48 +08:00
|
|
|
import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
|
|
|
|
|
|
|
|
part 'bridge_definitions.freezed.dart';
|
2023-11-04 22:55:48 +08:00
|
|
|
|
|
|
|
abstract class Rust {
|
2023-11-05 15:56:48 +08:00
|
|
|
Future<String> ping({dynamic hint});
|
|
|
|
|
|
|
|
FlutterRustBridgeTaskConstMeta get kPingConstMeta;
|
|
|
|
|
|
|
|
Stream<DownloadCallbackData> startDownload(
|
|
|
|
{required String url,
|
|
|
|
required String savePath,
|
|
|
|
required String fileName,
|
|
|
|
required int connectionCount,
|
|
|
|
dynamic hint});
|
2023-11-04 22:55:48 +08:00
|
|
|
|
2023-11-05 15:56:48 +08:00
|
|
|
FlutterRustBridgeTaskConstMeta get kStartDownloadConstMeta;
|
2023-11-04 22:55:48 +08:00
|
|
|
|
2023-11-05 15:56:48 +08:00
|
|
|
Future<void> cancelDownload({required String id, dynamic hint});
|
2023-11-04 22:55:48 +08:00
|
|
|
|
2023-11-05 15:56:48 +08:00
|
|
|
FlutterRustBridgeTaskConstMeta get kCancelDownloadConstMeta;
|
|
|
|
}
|
|
|
|
|
|
|
|
class DownloadCallbackData {
|
|
|
|
final String id;
|
|
|
|
final int total;
|
|
|
|
final int progress;
|
|
|
|
final int speed;
|
|
|
|
final MyDownloaderStatus status;
|
2023-11-04 22:55:48 +08:00
|
|
|
|
2023-11-05 15:56:48 +08:00
|
|
|
const DownloadCallbackData({
|
|
|
|
required this.id,
|
|
|
|
required this.total,
|
|
|
|
required this.progress,
|
|
|
|
required this.speed,
|
|
|
|
required this.status,
|
|
|
|
});
|
|
|
|
}
|
2023-11-04 22:55:48 +08:00
|
|
|
|
2023-11-05 15:56:48 +08:00
|
|
|
@freezed
|
|
|
|
sealed class MyDownloaderStatus with _$MyDownloaderStatus {
|
|
|
|
const factory MyDownloaderStatus.noStart() = MyDownloaderStatus_NoStart;
|
|
|
|
const factory MyDownloaderStatus.running() = MyDownloaderStatus_Running;
|
|
|
|
const factory MyDownloaderStatus.pending(
|
|
|
|
MyNetworkItemPendingType field0,
|
|
|
|
) = MyDownloaderStatus_Pending;
|
|
|
|
const factory MyDownloaderStatus.error(
|
|
|
|
String field0,
|
|
|
|
) = MyDownloaderStatus_Error;
|
|
|
|
const factory MyDownloaderStatus.finished() = MyDownloaderStatus_Finished;
|
2023-11-04 22:55:48 +08:00
|
|
|
}
|
|
|
|
|
2023-11-05 15:56:48 +08:00
|
|
|
enum MyNetworkItemPendingType {
|
|
|
|
QueueUp,
|
|
|
|
Starting,
|
|
|
|
Stopping,
|
|
|
|
Initializing,
|
2023-11-04 22:55:48 +08:00
|
|
|
}
|