getStringF static method

Future<String> getStringF(
  1. String? key, [
  2. String? defValue
])

Returns a Future. Returns '' if key is null.

Implementation

static Future<String> getStringF(String? key, [String? defValue]) async {
  String value;
  if (key == null) {
    return '';
  }
  if (_prefsInstance == null) {
    final prefs = await instance;
    value = prefs.getString(key) ?? defValue ?? '';
  } else {
    // SharedPreferences is available. Ignore init() function.
    _initCalled = true;
    value = getString(key, defValue);
  }
  return value;
}