import static method

Future<DynamicMap> import(
  1. String fileName
)

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,
  );
}