writeData static method

Future<bool> writeData(
  1. String key,
  2. String data
)

Writes provided data under provided key in shared preferences. Data is encrypted using AES. Returns true if data is successfully saved.

Implementation

static Future<bool> writeData(String key, String data) async {
  var result =
      await _channel.invokeMethod('writeData', {'key': key, 'data': data});
  if (result == true) {
    return true;
  } else {
    throw SharedPreferencesException(
        'Writing to shared preferences failed. Consider reopening or reinstalling the app.');
  }
}