mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 09:04:45 +08:00
新增 Rust 实现的多线程下载器,优化下载可靠性
This commit is contained in:
@ -7,28 +7,61 @@ import 'dart:async';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
|
||||
|
||||
part 'bridge_definitions.freezed.dart';
|
||||
|
||||
abstract class Rust {
|
||||
Future<Platform> platform({dynamic hint});
|
||||
Future<String> ping({dynamic hint});
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kPlatformConstMeta;
|
||||
FlutterRustBridgeTaskConstMeta get kPingConstMeta;
|
||||
|
||||
Future<int> add({required int left, required int right, dynamic hint});
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint});
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kAddConstMeta;
|
||||
FlutterRustBridgeTaskConstMeta get kStartDownloadConstMeta;
|
||||
|
||||
Future<bool> rustReleaseMode({dynamic hint});
|
||||
Future<void> cancelDownload({required String id, dynamic hint});
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kRustReleaseModeConstMeta;
|
||||
FlutterRustBridgeTaskConstMeta get kCancelDownloadConstMeta;
|
||||
}
|
||||
|
||||
enum Platform {
|
||||
Unknown,
|
||||
Android,
|
||||
Ios,
|
||||
Windows,
|
||||
Unix,
|
||||
MacIntel,
|
||||
MacApple,
|
||||
Wasm,
|
||||
class DownloadCallbackData {
|
||||
final String id;
|
||||
final int total;
|
||||
final int progress;
|
||||
final int speed;
|
||||
final MyDownloaderStatus status;
|
||||
|
||||
const DownloadCallbackData({
|
||||
required this.id,
|
||||
required this.total,
|
||||
required this.progress,
|
||||
required this.speed,
|
||||
required this.status,
|
||||
});
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
enum MyNetworkItemPendingType {
|
||||
QueueUp,
|
||||
Starting,
|
||||
Stopping,
|
||||
Initializing,
|
||||
}
|
||||
|
778
lib/common/rust/bridge_definitions.freezed.dart
Normal file
778
lib/common/rust/bridge_definitions.freezed.dart
Normal file
@ -0,0 +1,778 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'bridge_definitions.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$MyDownloaderStatus {
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() noStart,
|
||||
required TResult Function() running,
|
||||
required TResult Function(MyNetworkItemPendingType field0) pending,
|
||||
required TResult Function(String field0) error,
|
||||
required TResult Function() finished,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? noStart,
|
||||
TResult? Function()? running,
|
||||
TResult? Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult? Function(String field0)? error,
|
||||
TResult? Function()? finished,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? noStart,
|
||||
TResult Function()? running,
|
||||
TResult Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult Function(String field0)? error,
|
||||
TResult Function()? finished,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(MyDownloaderStatus_NoStart value) noStart,
|
||||
required TResult Function(MyDownloaderStatus_Running value) running,
|
||||
required TResult Function(MyDownloaderStatus_Pending value) pending,
|
||||
required TResult Function(MyDownloaderStatus_Error value) error,
|
||||
required TResult Function(MyDownloaderStatus_Finished value) finished,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult? Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult? Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult? Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult? Function(MyDownloaderStatus_Finished value)? finished,
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult Function(MyDownloaderStatus_Finished value)? finished,
|
||||
required TResult orElse(),
|
||||
}) =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $MyDownloaderStatusCopyWith<$Res> {
|
||||
factory $MyDownloaderStatusCopyWith(
|
||||
MyDownloaderStatus value, $Res Function(MyDownloaderStatus) then) =
|
||||
_$MyDownloaderStatusCopyWithImpl<$Res, MyDownloaderStatus>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$MyDownloaderStatusCopyWithImpl<$Res, $Val extends MyDownloaderStatus>
|
||||
implements $MyDownloaderStatusCopyWith<$Res> {
|
||||
_$MyDownloaderStatusCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MyDownloaderStatus_NoStartImplCopyWith<$Res> {
|
||||
factory _$$MyDownloaderStatus_NoStartImplCopyWith(
|
||||
_$MyDownloaderStatus_NoStartImpl value,
|
||||
$Res Function(_$MyDownloaderStatus_NoStartImpl) then) =
|
||||
__$$MyDownloaderStatus_NoStartImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MyDownloaderStatus_NoStartImplCopyWithImpl<$Res>
|
||||
extends _$MyDownloaderStatusCopyWithImpl<$Res,
|
||||
_$MyDownloaderStatus_NoStartImpl>
|
||||
implements _$$MyDownloaderStatus_NoStartImplCopyWith<$Res> {
|
||||
__$$MyDownloaderStatus_NoStartImplCopyWithImpl(
|
||||
_$MyDownloaderStatus_NoStartImpl _value,
|
||||
$Res Function(_$MyDownloaderStatus_NoStartImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$MyDownloaderStatus_NoStartImpl implements MyDownloaderStatus_NoStart {
|
||||
const _$MyDownloaderStatus_NoStartImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MyDownloaderStatus.noStart()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_NoStartImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() noStart,
|
||||
required TResult Function() running,
|
||||
required TResult Function(MyNetworkItemPendingType field0) pending,
|
||||
required TResult Function(String field0) error,
|
||||
required TResult Function() finished,
|
||||
}) {
|
||||
return noStart();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? noStart,
|
||||
TResult? Function()? running,
|
||||
TResult? Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult? Function(String field0)? error,
|
||||
TResult? Function()? finished,
|
||||
}) {
|
||||
return noStart?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? noStart,
|
||||
TResult Function()? running,
|
||||
TResult Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult Function(String field0)? error,
|
||||
TResult Function()? finished,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (noStart != null) {
|
||||
return noStart();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(MyDownloaderStatus_NoStart value) noStart,
|
||||
required TResult Function(MyDownloaderStatus_Running value) running,
|
||||
required TResult Function(MyDownloaderStatus_Pending value) pending,
|
||||
required TResult Function(MyDownloaderStatus_Error value) error,
|
||||
required TResult Function(MyDownloaderStatus_Finished value) finished,
|
||||
}) {
|
||||
return noStart(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult? Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult? Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult? Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult? Function(MyDownloaderStatus_Finished value)? finished,
|
||||
}) {
|
||||
return noStart?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult Function(MyDownloaderStatus_Finished value)? finished,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (noStart != null) {
|
||||
return noStart(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class MyDownloaderStatus_NoStart implements MyDownloaderStatus {
|
||||
const factory MyDownloaderStatus_NoStart() = _$MyDownloaderStatus_NoStartImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MyDownloaderStatus_RunningImplCopyWith<$Res> {
|
||||
factory _$$MyDownloaderStatus_RunningImplCopyWith(
|
||||
_$MyDownloaderStatus_RunningImpl value,
|
||||
$Res Function(_$MyDownloaderStatus_RunningImpl) then) =
|
||||
__$$MyDownloaderStatus_RunningImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MyDownloaderStatus_RunningImplCopyWithImpl<$Res>
|
||||
extends _$MyDownloaderStatusCopyWithImpl<$Res,
|
||||
_$MyDownloaderStatus_RunningImpl>
|
||||
implements _$$MyDownloaderStatus_RunningImplCopyWith<$Res> {
|
||||
__$$MyDownloaderStatus_RunningImplCopyWithImpl(
|
||||
_$MyDownloaderStatus_RunningImpl _value,
|
||||
$Res Function(_$MyDownloaderStatus_RunningImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$MyDownloaderStatus_RunningImpl implements MyDownloaderStatus_Running {
|
||||
const _$MyDownloaderStatus_RunningImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MyDownloaderStatus.running()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_RunningImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() noStart,
|
||||
required TResult Function() running,
|
||||
required TResult Function(MyNetworkItemPendingType field0) pending,
|
||||
required TResult Function(String field0) error,
|
||||
required TResult Function() finished,
|
||||
}) {
|
||||
return running();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? noStart,
|
||||
TResult? Function()? running,
|
||||
TResult? Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult? Function(String field0)? error,
|
||||
TResult? Function()? finished,
|
||||
}) {
|
||||
return running?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? noStart,
|
||||
TResult Function()? running,
|
||||
TResult Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult Function(String field0)? error,
|
||||
TResult Function()? finished,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (running != null) {
|
||||
return running();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(MyDownloaderStatus_NoStart value) noStart,
|
||||
required TResult Function(MyDownloaderStatus_Running value) running,
|
||||
required TResult Function(MyDownloaderStatus_Pending value) pending,
|
||||
required TResult Function(MyDownloaderStatus_Error value) error,
|
||||
required TResult Function(MyDownloaderStatus_Finished value) finished,
|
||||
}) {
|
||||
return running(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult? Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult? Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult? Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult? Function(MyDownloaderStatus_Finished value)? finished,
|
||||
}) {
|
||||
return running?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult Function(MyDownloaderStatus_Finished value)? finished,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (running != null) {
|
||||
return running(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class MyDownloaderStatus_Running implements MyDownloaderStatus {
|
||||
const factory MyDownloaderStatus_Running() = _$MyDownloaderStatus_RunningImpl;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MyDownloaderStatus_PendingImplCopyWith<$Res> {
|
||||
factory _$$MyDownloaderStatus_PendingImplCopyWith(
|
||||
_$MyDownloaderStatus_PendingImpl value,
|
||||
$Res Function(_$MyDownloaderStatus_PendingImpl) then) =
|
||||
__$$MyDownloaderStatus_PendingImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({MyNetworkItemPendingType field0});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MyDownloaderStatus_PendingImplCopyWithImpl<$Res>
|
||||
extends _$MyDownloaderStatusCopyWithImpl<$Res,
|
||||
_$MyDownloaderStatus_PendingImpl>
|
||||
implements _$$MyDownloaderStatus_PendingImplCopyWith<$Res> {
|
||||
__$$MyDownloaderStatus_PendingImplCopyWithImpl(
|
||||
_$MyDownloaderStatus_PendingImpl _value,
|
||||
$Res Function(_$MyDownloaderStatus_PendingImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? field0 = null,
|
||||
}) {
|
||||
return _then(_$MyDownloaderStatus_PendingImpl(
|
||||
null == field0
|
||||
? _value.field0
|
||||
: field0 // ignore: cast_nullable_to_non_nullable
|
||||
as MyNetworkItemPendingType,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$MyDownloaderStatus_PendingImpl implements MyDownloaderStatus_Pending {
|
||||
const _$MyDownloaderStatus_PendingImpl(this.field0);
|
||||
|
||||
@override
|
||||
final MyNetworkItemPendingType field0;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MyDownloaderStatus.pending(field0: $field0)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_PendingImpl &&
|
||||
(identical(other.field0, field0) || other.field0 == field0));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, field0);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$MyDownloaderStatus_PendingImplCopyWith<_$MyDownloaderStatus_PendingImpl>
|
||||
get copyWith => __$$MyDownloaderStatus_PendingImplCopyWithImpl<
|
||||
_$MyDownloaderStatus_PendingImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() noStart,
|
||||
required TResult Function() running,
|
||||
required TResult Function(MyNetworkItemPendingType field0) pending,
|
||||
required TResult Function(String field0) error,
|
||||
required TResult Function() finished,
|
||||
}) {
|
||||
return pending(field0);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? noStart,
|
||||
TResult? Function()? running,
|
||||
TResult? Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult? Function(String field0)? error,
|
||||
TResult? Function()? finished,
|
||||
}) {
|
||||
return pending?.call(field0);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? noStart,
|
||||
TResult Function()? running,
|
||||
TResult Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult Function(String field0)? error,
|
||||
TResult Function()? finished,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (pending != null) {
|
||||
return pending(field0);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(MyDownloaderStatus_NoStart value) noStart,
|
||||
required TResult Function(MyDownloaderStatus_Running value) running,
|
||||
required TResult Function(MyDownloaderStatus_Pending value) pending,
|
||||
required TResult Function(MyDownloaderStatus_Error value) error,
|
||||
required TResult Function(MyDownloaderStatus_Finished value) finished,
|
||||
}) {
|
||||
return pending(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult? Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult? Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult? Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult? Function(MyDownloaderStatus_Finished value)? finished,
|
||||
}) {
|
||||
return pending?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult Function(MyDownloaderStatus_Finished value)? finished,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (pending != null) {
|
||||
return pending(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class MyDownloaderStatus_Pending implements MyDownloaderStatus {
|
||||
const factory MyDownloaderStatus_Pending(
|
||||
final MyNetworkItemPendingType field0) = _$MyDownloaderStatus_PendingImpl;
|
||||
|
||||
MyNetworkItemPendingType get field0;
|
||||
@JsonKey(ignore: true)
|
||||
_$$MyDownloaderStatus_PendingImplCopyWith<_$MyDownloaderStatus_PendingImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MyDownloaderStatus_ErrorImplCopyWith<$Res> {
|
||||
factory _$$MyDownloaderStatus_ErrorImplCopyWith(
|
||||
_$MyDownloaderStatus_ErrorImpl value,
|
||||
$Res Function(_$MyDownloaderStatus_ErrorImpl) then) =
|
||||
__$$MyDownloaderStatus_ErrorImplCopyWithImpl<$Res>;
|
||||
@useResult
|
||||
$Res call({String field0});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MyDownloaderStatus_ErrorImplCopyWithImpl<$Res>
|
||||
extends _$MyDownloaderStatusCopyWithImpl<$Res,
|
||||
_$MyDownloaderStatus_ErrorImpl>
|
||||
implements _$$MyDownloaderStatus_ErrorImplCopyWith<$Res> {
|
||||
__$$MyDownloaderStatus_ErrorImplCopyWithImpl(
|
||||
_$MyDownloaderStatus_ErrorImpl _value,
|
||||
$Res Function(_$MyDownloaderStatus_ErrorImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? field0 = null,
|
||||
}) {
|
||||
return _then(_$MyDownloaderStatus_ErrorImpl(
|
||||
null == field0
|
||||
? _value.field0
|
||||
: field0 // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$MyDownloaderStatus_ErrorImpl implements MyDownloaderStatus_Error {
|
||||
const _$MyDownloaderStatus_ErrorImpl(this.field0);
|
||||
|
||||
@override
|
||||
final String field0;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MyDownloaderStatus.error(field0: $field0)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_ErrorImpl &&
|
||||
(identical(other.field0, field0) || other.field0 == field0));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, field0);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$MyDownloaderStatus_ErrorImplCopyWith<_$MyDownloaderStatus_ErrorImpl>
|
||||
get copyWith => __$$MyDownloaderStatus_ErrorImplCopyWithImpl<
|
||||
_$MyDownloaderStatus_ErrorImpl>(this, _$identity);
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() noStart,
|
||||
required TResult Function() running,
|
||||
required TResult Function(MyNetworkItemPendingType field0) pending,
|
||||
required TResult Function(String field0) error,
|
||||
required TResult Function() finished,
|
||||
}) {
|
||||
return error(field0);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? noStart,
|
||||
TResult? Function()? running,
|
||||
TResult? Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult? Function(String field0)? error,
|
||||
TResult? Function()? finished,
|
||||
}) {
|
||||
return error?.call(field0);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? noStart,
|
||||
TResult Function()? running,
|
||||
TResult Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult Function(String field0)? error,
|
||||
TResult Function()? finished,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(field0);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(MyDownloaderStatus_NoStart value) noStart,
|
||||
required TResult Function(MyDownloaderStatus_Running value) running,
|
||||
required TResult Function(MyDownloaderStatus_Pending value) pending,
|
||||
required TResult Function(MyDownloaderStatus_Error value) error,
|
||||
required TResult Function(MyDownloaderStatus_Finished value) finished,
|
||||
}) {
|
||||
return error(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult? Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult? Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult? Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult? Function(MyDownloaderStatus_Finished value)? finished,
|
||||
}) {
|
||||
return error?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult Function(MyDownloaderStatus_Finished value)? finished,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (error != null) {
|
||||
return error(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class MyDownloaderStatus_Error implements MyDownloaderStatus {
|
||||
const factory MyDownloaderStatus_Error(final String field0) =
|
||||
_$MyDownloaderStatus_ErrorImpl;
|
||||
|
||||
String get field0;
|
||||
@JsonKey(ignore: true)
|
||||
_$$MyDownloaderStatus_ErrorImplCopyWith<_$MyDownloaderStatus_ErrorImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MyDownloaderStatus_FinishedImplCopyWith<$Res> {
|
||||
factory _$$MyDownloaderStatus_FinishedImplCopyWith(
|
||||
_$MyDownloaderStatus_FinishedImpl value,
|
||||
$Res Function(_$MyDownloaderStatus_FinishedImpl) then) =
|
||||
__$$MyDownloaderStatus_FinishedImplCopyWithImpl<$Res>;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MyDownloaderStatus_FinishedImplCopyWithImpl<$Res>
|
||||
extends _$MyDownloaderStatusCopyWithImpl<$Res,
|
||||
_$MyDownloaderStatus_FinishedImpl>
|
||||
implements _$$MyDownloaderStatus_FinishedImplCopyWith<$Res> {
|
||||
__$$MyDownloaderStatus_FinishedImplCopyWithImpl(
|
||||
_$MyDownloaderStatus_FinishedImpl _value,
|
||||
$Res Function(_$MyDownloaderStatus_FinishedImpl) _then)
|
||||
: super(_value, _then);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$MyDownloaderStatus_FinishedImpl implements MyDownloaderStatus_Finished {
|
||||
const _$MyDownloaderStatus_FinishedImpl();
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MyDownloaderStatus.finished()';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MyDownloaderStatus_FinishedImpl);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => runtimeType.hashCode;
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult when<TResult extends Object?>({
|
||||
required TResult Function() noStart,
|
||||
required TResult Function() running,
|
||||
required TResult Function(MyNetworkItemPendingType field0) pending,
|
||||
required TResult Function(String field0) error,
|
||||
required TResult Function() finished,
|
||||
}) {
|
||||
return finished();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? whenOrNull<TResult extends Object?>({
|
||||
TResult? Function()? noStart,
|
||||
TResult? Function()? running,
|
||||
TResult? Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult? Function(String field0)? error,
|
||||
TResult? Function()? finished,
|
||||
}) {
|
||||
return finished?.call();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeWhen<TResult extends Object?>({
|
||||
TResult Function()? noStart,
|
||||
TResult Function()? running,
|
||||
TResult Function(MyNetworkItemPendingType field0)? pending,
|
||||
TResult Function(String field0)? error,
|
||||
TResult Function()? finished,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (finished != null) {
|
||||
return finished();
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult map<TResult extends Object?>({
|
||||
required TResult Function(MyDownloaderStatus_NoStart value) noStart,
|
||||
required TResult Function(MyDownloaderStatus_Running value) running,
|
||||
required TResult Function(MyDownloaderStatus_Pending value) pending,
|
||||
required TResult Function(MyDownloaderStatus_Error value) error,
|
||||
required TResult Function(MyDownloaderStatus_Finished value) finished,
|
||||
}) {
|
||||
return finished(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult? mapOrNull<TResult extends Object?>({
|
||||
TResult? Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult? Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult? Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult? Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult? Function(MyDownloaderStatus_Finished value)? finished,
|
||||
}) {
|
||||
return finished?.call(this);
|
||||
}
|
||||
|
||||
@override
|
||||
@optionalTypeArgs
|
||||
TResult maybeMap<TResult extends Object?>({
|
||||
TResult Function(MyDownloaderStatus_NoStart value)? noStart,
|
||||
TResult Function(MyDownloaderStatus_Running value)? running,
|
||||
TResult Function(MyDownloaderStatus_Pending value)? pending,
|
||||
TResult Function(MyDownloaderStatus_Error value)? error,
|
||||
TResult Function(MyDownloaderStatus_Finished value)? finished,
|
||||
required TResult orElse(),
|
||||
}) {
|
||||
if (finished != null) {
|
||||
return finished(this);
|
||||
}
|
||||
return orElse();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class MyDownloaderStatus_Finished implements MyDownloaderStatus {
|
||||
const factory MyDownloaderStatus_Finished() =
|
||||
_$MyDownloaderStatus_FinishedImpl;
|
||||
}
|
@ -25,57 +25,66 @@ class RustImpl implements Rust {
|
||||
factory RustImpl.wasm(FutureOr<WasmModule> module) =>
|
||||
RustImpl(module as ExternalLibrary);
|
||||
RustImpl.raw(this._platform);
|
||||
Future<Platform> platform({dynamic hint}) {
|
||||
Future<String> ping({dynamic hint}) {
|
||||
return _platform.executeNormal(FlutterRustBridgeTask(
|
||||
callFfi: (port_) => _platform.inner.wire_platform(port_),
|
||||
parseSuccessData: _wire2api_platform,
|
||||
callFfi: (port_) => _platform.inner.wire_ping(port_),
|
||||
parseSuccessData: _wire2api_String,
|
||||
parseErrorData: null,
|
||||
constMeta: kPlatformConstMeta,
|
||||
constMeta: kPingConstMeta,
|
||||
argValues: [],
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kPlatformConstMeta =>
|
||||
FlutterRustBridgeTaskConstMeta get kPingConstMeta =>
|
||||
const FlutterRustBridgeTaskConstMeta(
|
||||
debugName: "platform",
|
||||
debugName: "ping",
|
||||
argNames: [],
|
||||
);
|
||||
|
||||
Future<int> add({required int left, required int right, dynamic hint}) {
|
||||
var arg0 = api2wire_usize(left);
|
||||
var arg1 = api2wire_usize(right);
|
||||
return _platform.executeNormal(FlutterRustBridgeTask(
|
||||
callFfi: (port_) => _platform.inner.wire_add(port_, arg0, arg1),
|
||||
parseSuccessData: _wire2api_usize,
|
||||
Stream<DownloadCallbackData> startDownload(
|
||||
{required String url,
|
||||
required String savePath,
|
||||
required String fileName,
|
||||
required int connectionCount,
|
||||
dynamic hint}) {
|
||||
var arg0 = _platform.api2wire_String(url);
|
||||
var arg1 = _platform.api2wire_String(savePath);
|
||||
var arg2 = _platform.api2wire_String(fileName);
|
||||
var arg3 = api2wire_u8(connectionCount);
|
||||
return _platform.executeStream(FlutterRustBridgeTask(
|
||||
callFfi: (port_) =>
|
||||
_platform.inner.wire_start_download(port_, arg0, arg1, arg2, arg3),
|
||||
parseSuccessData: _wire2api_download_callback_data,
|
||||
parseErrorData: null,
|
||||
constMeta: kAddConstMeta,
|
||||
argValues: [left, right],
|
||||
constMeta: kStartDownloadConstMeta,
|
||||
argValues: [url, savePath, fileName, connectionCount],
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kAddConstMeta =>
|
||||
FlutterRustBridgeTaskConstMeta get kStartDownloadConstMeta =>
|
||||
const FlutterRustBridgeTaskConstMeta(
|
||||
debugName: "add",
|
||||
argNames: ["left", "right"],
|
||||
debugName: "start_download",
|
||||
argNames: ["url", "savePath", "fileName", "connectionCount"],
|
||||
);
|
||||
|
||||
Future<bool> rustReleaseMode({dynamic hint}) {
|
||||
Future<void> cancelDownload({required String id, dynamic hint}) {
|
||||
var arg0 = _platform.api2wire_String(id);
|
||||
return _platform.executeNormal(FlutterRustBridgeTask(
|
||||
callFfi: (port_) => _platform.inner.wire_rust_release_mode(port_),
|
||||
parseSuccessData: _wire2api_bool,
|
||||
callFfi: (port_) => _platform.inner.wire_cancel_download(port_, arg0),
|
||||
parseSuccessData: _wire2api_unit,
|
||||
parseErrorData: null,
|
||||
constMeta: kRustReleaseModeConstMeta,
|
||||
argValues: [],
|
||||
constMeta: kCancelDownloadConstMeta,
|
||||
argValues: [id],
|
||||
hint: hint,
|
||||
));
|
||||
}
|
||||
|
||||
FlutterRustBridgeTaskConstMeta get kRustReleaseModeConstMeta =>
|
||||
FlutterRustBridgeTaskConstMeta get kCancelDownloadConstMeta =>
|
||||
const FlutterRustBridgeTaskConstMeta(
|
||||
debugName: "rust_release_mode",
|
||||
argNames: [],
|
||||
debugName: "cancel_download",
|
||||
argNames: ["id"],
|
||||
);
|
||||
|
||||
void dispose() {
|
||||
@ -83,29 +92,76 @@ class RustImpl implements Rust {
|
||||
}
|
||||
// Section: wire2api
|
||||
|
||||
bool _wire2api_bool(dynamic raw) {
|
||||
return raw as bool;
|
||||
String _wire2api_String(dynamic raw) {
|
||||
return raw as String;
|
||||
}
|
||||
|
||||
DownloadCallbackData _wire2api_download_callback_data(dynamic raw) {
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 5)
|
||||
throw Exception('unexpected arr length: expect 5 but see ${arr.length}');
|
||||
return DownloadCallbackData(
|
||||
id: _wire2api_String(arr[0]),
|
||||
total: _wire2api_u64(arr[1]),
|
||||
progress: _wire2api_u64(arr[2]),
|
||||
speed: _wire2api_u64(arr[3]),
|
||||
status: _wire2api_my_downloader_status(arr[4]),
|
||||
);
|
||||
}
|
||||
|
||||
int _wire2api_i32(dynamic raw) {
|
||||
return raw as int;
|
||||
}
|
||||
|
||||
Platform _wire2api_platform(dynamic raw) {
|
||||
return Platform.values[raw as int];
|
||||
MyDownloaderStatus _wire2api_my_downloader_status(dynamic raw) {
|
||||
switch (raw[0]) {
|
||||
case 0:
|
||||
return MyDownloaderStatus_NoStart();
|
||||
case 1:
|
||||
return MyDownloaderStatus_Running();
|
||||
case 2:
|
||||
return MyDownloaderStatus_Pending(
|
||||
_wire2api_my_network_item_pending_type(raw[1]),
|
||||
);
|
||||
case 3:
|
||||
return MyDownloaderStatus_Error(
|
||||
_wire2api_String(raw[1]),
|
||||
);
|
||||
case 4:
|
||||
return MyDownloaderStatus_Finished();
|
||||
default:
|
||||
throw Exception("unreachable");
|
||||
}
|
||||
}
|
||||
|
||||
int _wire2api_usize(dynamic raw) {
|
||||
MyNetworkItemPendingType _wire2api_my_network_item_pending_type(dynamic raw) {
|
||||
return MyNetworkItemPendingType.values[raw as int];
|
||||
}
|
||||
|
||||
int _wire2api_u64(dynamic raw) {
|
||||
return castInt(raw);
|
||||
}
|
||||
|
||||
int _wire2api_u8(dynamic raw) {
|
||||
return raw as int;
|
||||
}
|
||||
|
||||
Uint8List _wire2api_uint_8_list(dynamic raw) {
|
||||
return raw as Uint8List;
|
||||
}
|
||||
|
||||
void _wire2api_unit(dynamic raw) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Section: api2wire
|
||||
|
||||
@protected
|
||||
int api2wire_usize(int raw) {
|
||||
int api2wire_u8(int raw) {
|
||||
return raw;
|
||||
}
|
||||
|
||||
// Section: finalizer
|
||||
|
||||
class RustPlatform extends FlutterRustBridgeBase<RustWire> {
|
||||
@ -113,6 +169,17 @@ class RustPlatform extends FlutterRustBridgeBase<RustWire> {
|
||||
|
||||
// Section: api2wire
|
||||
|
||||
@protected
|
||||
ffi.Pointer<wire_uint_8_list> api2wire_String(String raw) {
|
||||
return api2wire_uint_8_list(utf8.encoder.convert(raw));
|
||||
}
|
||||
|
||||
@protected
|
||||
ffi.Pointer<wire_uint_8_list> api2wire_uint_8_list(Uint8List raw) {
|
||||
final ans = inner.new_uint_8_list_0(raw.length);
|
||||
ans.ref.ptr.asTypedList(raw.length).setAll(0, raw);
|
||||
return ans;
|
||||
}
|
||||
// Section: finalizer
|
||||
|
||||
// Section: api_fill_to_wire
|
||||
@ -213,51 +280,77 @@ class RustWire implements FlutterRustBridgeWireBase {
|
||||
late final _init_frb_dart_api_dl = _init_frb_dart_api_dlPtr
|
||||
.asFunction<int Function(ffi.Pointer<ffi.Void>)>();
|
||||
|
||||
void wire_platform(
|
||||
void wire_ping(
|
||||
int port_,
|
||||
) {
|
||||
return _wire_platform(
|
||||
return _wire_ping(
|
||||
port_,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_platformPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>(
|
||||
'wire_platform');
|
||||
late final _wire_platform =
|
||||
_wire_platformPtr.asFunction<void Function(int)>();
|
||||
late final _wire_pingPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>('wire_ping');
|
||||
late final _wire_ping = _wire_pingPtr.asFunction<void Function(int)>();
|
||||
|
||||
void wire_add(
|
||||
void wire_start_download(
|
||||
int port_,
|
||||
int left,
|
||||
int right,
|
||||
ffi.Pointer<wire_uint_8_list> url,
|
||||
ffi.Pointer<wire_uint_8_list> save_path,
|
||||
ffi.Pointer<wire_uint_8_list> file_name,
|
||||
int connection_count,
|
||||
) {
|
||||
return _wire_add(
|
||||
return _wire_start_download(
|
||||
port_,
|
||||
left,
|
||||
right,
|
||||
url,
|
||||
save_path,
|
||||
file_name,
|
||||
connection_count,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_addPtr = _lookup<
|
||||
late final _wire_start_downloadPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(ffi.Int64, ffi.UintPtr, ffi.UintPtr)>>('wire_add');
|
||||
late final _wire_add =
|
||||
_wire_addPtr.asFunction<void Function(int, int, int)>();
|
||||
ffi.Void Function(
|
||||
ffi.Int64,
|
||||
ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Uint8)>>('wire_start_download');
|
||||
late final _wire_start_download = _wire_start_downloadPtr.asFunction<
|
||||
void Function(int, ffi.Pointer<wire_uint_8_list>,
|
||||
ffi.Pointer<wire_uint_8_list>, ffi.Pointer<wire_uint_8_list>, int)>();
|
||||
|
||||
void wire_rust_release_mode(
|
||||
void wire_cancel_download(
|
||||
int port_,
|
||||
ffi.Pointer<wire_uint_8_list> id,
|
||||
) {
|
||||
return _wire_rust_release_mode(
|
||||
return _wire_cancel_download(
|
||||
port_,
|
||||
id,
|
||||
);
|
||||
}
|
||||
|
||||
late final _wire_rust_release_modePtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64)>>(
|
||||
'wire_rust_release_mode');
|
||||
late final _wire_rust_release_mode =
|
||||
_wire_rust_release_modePtr.asFunction<void Function(int)>();
|
||||
late final _wire_cancel_downloadPtr = _lookup<
|
||||
ffi.NativeFunction<
|
||||
ffi.Void Function(ffi.Int64,
|
||||
ffi.Pointer<wire_uint_8_list>)>>('wire_cancel_download');
|
||||
late final _wire_cancel_download = _wire_cancel_downloadPtr
|
||||
.asFunction<void Function(int, ffi.Pointer<wire_uint_8_list>)>();
|
||||
|
||||
ffi.Pointer<wire_uint_8_list> new_uint_8_list_0(
|
||||
int len,
|
||||
) {
|
||||
return _new_uint_8_list_0(
|
||||
len,
|
||||
);
|
||||
}
|
||||
|
||||
late final _new_uint_8_list_0Ptr = _lookup<
|
||||
ffi
|
||||
.NativeFunction<ffi.Pointer<wire_uint_8_list> Function(ffi.Int32)>>(
|
||||
'new_uint_8_list_0');
|
||||
late final _new_uint_8_list_0 = _new_uint_8_list_0Ptr
|
||||
.asFunction<ffi.Pointer<wire_uint_8_list> Function(int)>();
|
||||
|
||||
void free_WireSyncReturn(
|
||||
WireSyncReturn ptr,
|
||||
@ -276,6 +369,13 @@ class RustWire implements FlutterRustBridgeWireBase {
|
||||
|
||||
final class _Dart_Handle extends ffi.Opaque {}
|
||||
|
||||
final class wire_uint_8_list extends ffi.Struct {
|
||||
external ffi.Pointer<ffi.Uint8> ptr;
|
||||
|
||||
@ffi.Int32()
|
||||
external int len;
|
||||
}
|
||||
|
||||
typedef DartPostCObjectFnType = ffi.Pointer<
|
||||
ffi.NativeFunction<
|
||||
ffi.Bool Function(DartPort port_id, ffi.Pointer<ffi.Void> message)>>;
|
||||
|
Reference in New Issue
Block a user