import static method
Import the data stored in fileName
.
For Web, retrieve from LocalStorage
with fileName
as a key.
Decryption is performed based on fileName
. If the fileName
is different from the exported file name, the file cannot be imported.
fileName
に保存されているデータをインポートします。
Webの場合はfileName
をキーにした状態でLocalStorage
から取得します。
fileName
に基づく復号化を行ないます。エクスポート時とfileName
が異なる場合インポートできません。
Implementation
static Future<DynamicMap> import(String fileName) async {
return await compute<String, DynamicMap>(
(fileName) async {
final file = File(fileName);
if (!file.existsSync()) {
throw Exception("This file [$fileName] is not found.");
}
final json = await file.readAsString();
return jsonDecodeAsMap(json.fromAES(fileName.last().toSHA1()), {});
},
fileName,
);
}