setMapData<T> static method
设置Map类型到缓存中去,
cast 是否强制转换,强制转换成字符串有可能会转换的不完整
Implementation
static Future<bool> setMapData<T>(String key, T value,
{bool cast = false}) async {
if (_prefs == null) await getInstance();
String newValue = cast ? value.toString() : json.encode(value);
return await _prefs?.setString(key, newValue) as bool;
}