setData static method
Implementation
static setData(DataType dataType, String key, var value) async {
await _init();
switch (dataType) {
case DataType.string:
await sharedPreferences!.setString(key, value);
break;
case DataType.bool:
if ([null, ""].contains(value)) {
await sharedPreferences!.setBool(key, false);
} else {
await sharedPreferences!.setBool(key, value);
}
break;
case DataType.int:
await sharedPreferences!.setInt(key, value);
break;
default:
await sharedPreferences!.setString(key, value);
break;
}
}