getJson method Null safety

Map<String, dynamic>? getJson(
  1. String key
)

Implementation

Map<String, dynamic>? getJson(String key) {
  String? strValue = _prefs.getString(key);
  if (strValue == null) {
    return null;
  } else {
    return json.decode(strValue);
  }
}