getString static method

Future<String> getString(
  1. String key
)

Get a string instance from the shared preferences

Implementation

static Future<String> getString(String key) async {
  final SharedPreferences prefs = await SharedPreferences.getInstance();
  final String? preferences = prefs.getString(key);
  if (preferences != null) {
    return preferences;
  } else {
    return '';
  }
}