mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-23 16:45:27 +01:00
opt.: multi process
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:computer/computer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/core/extension/context/common.dart';
|
||||
import 'package:toolbox/core/extension/context/dialog.dart';
|
||||
@@ -206,7 +206,7 @@ class BackupPage extends StatelessWidget {
|
||||
|
||||
try {
|
||||
context.showLoadingDialog();
|
||||
final backup = await compute(Backup.fromJsonString, text.trim());
|
||||
final backup = await Computer.shared.start(Backup.fromJsonString, text.trim());
|
||||
if (backupFormatVersion != backup.version) {
|
||||
context.showSnackBar(l10n.backupVersionNotMatch);
|
||||
return;
|
||||
@@ -283,7 +283,7 @@ class BackupPage extends StatelessWidget {
|
||||
return;
|
||||
}
|
||||
final dlFile = await File(fileName).readAsString();
|
||||
final dlBak = await compute(Backup.fromJsonString, dlFile);
|
||||
final dlBak = await Computer.shared.start(Backup.fromJsonString, dlFile);
|
||||
await dlBak.restore(force: true);
|
||||
webdavLoading.value = false;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:code_text_field/code_text_field.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:computer/computer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_highlight/theme_map.dart';
|
||||
import 'package:flutter_highlight/themes/a11y-light.dart';
|
||||
@@ -76,7 +76,7 @@ class _EditorPageState extends State<EditorPage> {
|
||||
|
||||
Future<void> _setupCtrl() async {
|
||||
if (widget.path != null) {
|
||||
final code = await compute(
|
||||
final code = await Computer.shared.start(
|
||||
(path) async => await File(path).readAsString(),
|
||||
widget.path!,
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:computer/computer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:toolbox/core/extension/context/common.dart';
|
||||
@@ -134,7 +134,7 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage> {
|
||||
_loading = UIs.centerSizedLoading;
|
||||
});
|
||||
try {
|
||||
final decrypted = await compute(decyptPem, [key, pwd]);
|
||||
final decrypted = await Computer.shared.start(decyptPem, [key, pwd]);
|
||||
final pki = PrivateKeyInfo(id: name, key: decrypted);
|
||||
if (widget.pki != null) {
|
||||
Pros.key.update(widget.pki!, pki);
|
||||
|
||||
Reference in New Issue
Block a user