getJSONAsync function
Returns a JSON if exists in SharedPref
Implementation
Map<String, dynamic> getJSONAsync(String key,
{Map<String, dynamic>? defaultValue}) {
if (sharedPreferences.containsKey(key) &&
(sharedPreferences.getString(key)?.isNotEmpty ?? false)) {
return jsonDecode(sharedPreferences.getString(key)!);
} else {
return defaultValue ?? {};
}
}