getString static method

Future<String?> getString(
  1. String key
)

Implementation

static Future<String?> getString(String key) async {
  SharedPreferences prefs = await SharedPreferences.getInstance();

  String? val = prefs.getString(key);

  if (val != null) {
    return val;
  } else {
    return null;
  }
}