mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-05 20:48:24 +00:00
Fix error map in handler
This commit is contained in:
+8
-4
@@ -68,9 +68,14 @@ void errorHandler(Object exception, StackTrace? stack) {
|
||||
_dir ??= await getApplicationDocumentsDirectory();
|
||||
final file = File('${_dir!.path}/errors.json');
|
||||
|
||||
final errorMap = await file.exists()
|
||||
? Map<String, String>.from(jsonDecode(await file.readAsString()))
|
||||
: <String, String>{};
|
||||
late final Map<String, dynamic> errorMap;
|
||||
if (await file.exists()) {
|
||||
final contents = await file.readAsString();
|
||||
errorMap =
|
||||
contents.isNotEmpty ? jsonDecode(await file.readAsString()) : {};
|
||||
} else {
|
||||
errorMap = {};
|
||||
}
|
||||
|
||||
for (final record in records) {
|
||||
final full =
|
||||
@@ -81,7 +86,6 @@ void errorHandler(Object exception, StackTrace? stack) {
|
||||
errorMap[key] = full;
|
||||
}
|
||||
}
|
||||
print(errorMap.length);
|
||||
await file.writeAsString(jsonEncode(errorMap));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user