From 5f0c0a7e53e770b514cdc6fb786fc30ea6ea43f3 Mon Sep 17 00:00:00 2001 From: Mumulhl Date: Sat, 18 Jan 2025 15:09:05 +0800 Subject: [PATCH] fix: import wordbook --- lib/pages/main/settings.dart | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/pages/main/settings.dart b/lib/pages/main/settings.dart index 181d68a..7dd6d58 100644 --- a/lib/pages/main/settings.dart +++ b/lib/pages/main/settings.dart @@ -1,5 +1,4 @@ import "dart:convert"; -import "dart:io"; import "package:ciyue/database/app.dart"; import "package:ciyue/dictionary.dart"; @@ -161,10 +160,9 @@ class Import extends StatelessWidget { return; } - final file = File(xFile.path), - input = await file.readAsLines(), - wordsJson = jsonDecode(input[0]), - tagsJson = jsonDecode(input[1]); + final content = (await xFile.readAsString()).split("\n"), + wordsJson = jsonDecode(content[0]), + tagsJson = jsonDecode(content[1]); final wordsData = []; for (final i in wordsJson) {