feat: 保存配置

This commit is contained in:
2026-01-07 17:33:55 -08:00
parent 9563a81a6e
commit 3f429e5546
17 changed files with 4124 additions and 1271 deletions
+21
View File
@@ -0,0 +1,21 @@
import 'dart:async';
import 'dart:isolate';
/// Simple worker that executes functions in a separate isolate.
/// Replacement for combine package's CombineWorker.
class IsolateWorker {
/// Execute a function in a separate isolate and return the result.
///
/// Note: The function must be a top-level function or a static method,
/// and it cannot capture non-sendable objects from the surrounding scope.
Future<T> execute<T>(T Function() computation, {bool allowSyncFallback = false}) async {
try {
return await Isolate.run(computation);
} catch (e) {
if (!allowSyncFallback) {
rethrow;
}
return computation();
}
}
}