put method

dynamic put(
  1. String key,
  2. dynamic value
)

Save to local storage

Implementation

put(String key, dynamic value) async {
  try {
    key = '${sanitizeFilename(key)}.boxx';
    if (!kIsWeb) {
      if (encryptionKey == null) {
        File('$path/$key').writeAsString(value);
      } else {
        if (mode == EncryptionMode.fernet) {
          File('$path/$key')
              .writeAsString(fernet.encryptFernet(value, encryptionKey!));
        }
        {
          File('$path/$key')
              .writeAsString(aes.encryptAES(value, encryptionKey!));
        }
      }
    }
  } on Exception catch (e) {
    debugPrint(e.toString());
  }
}