Initial commit: 91dj android client dev_1.0.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
谢宇宁
2026-10-08 11:37:25 +07:00
co-authored by Claude Opus 5.5
commit 97dd6a739a
1262 changed files with 119813 additions and 0 deletions
@@ -0,0 +1,32 @@
import 'dart:io';
import 'dart:ui';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
// 必须标注:原生启动后台 isolate 时要从 native 闭包化这个入口函数,
// 新版 Flutter/Dart 不加 @pragma('vm:entry-point') 会报 "To closurize ... it must be annotated",
// 后台 isolate 起不来 → 下载进度/成功回调永远到不了 Dart,进度条不刷新。
@pragma('vm:entry-point')
void callbackDispatcher() {
// Initialize state necessary for MethodChannels.
WidgetsFlutterBinding.ensureInitialized();
const MethodChannel backgroundChannel = MethodChannel('vincent/m3u8_downloader_background', JSONMethodCodec());
backgroundChannel.setMethodCallHandler((MethodCall call) async {
final dynamic args = call.arguments;
final CallbackHandle handle = CallbackHandle.fromRawHandle(args[0]);
final Function? closure = PluginUtilities.getCallbackFromHandle(handle);
if (closure == null) {
print('Fatal: could not find callback');
exit(-1);
}
closure(args[1]);
});
backgroundChannel.invokeMethod('didInitializeDispatcher');
}