save method

Future<void> save(
  1. String key,
  2. dynamic value
)

Implementation

Future<void> save(String key, dynamic value) async{
  EncryptedSharedPreferences pref = _pref!;
  if(value is double){
    await pref.setDouble(key, value);
  }
  else if(value is int){
    await pref.setInt(key, value);
  }
  else if(value is String){
    await pref.setString(key, value);
  }
  // else if(value is List<String>){
  //   await pref.setStringList(key, value);
  // }
  else if(value is bool){
    await pref.setBoolean(key, value);
  }
  else if(value is NUIEnt){
    await pref.setString(key, jsonEncode(value));
  }
  else{
    throw new Exception("NUIEncSharedPrefUtil -> value type of ${value.runtimeType} is not an acceptable value for shared preference");
  }
}