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).validate().isNotEmpty) {
return jsonDecode(sharedPreferences.getString(key)!);
} else {
return defaultValue ?? {};
}
}