getString static method

String getString(
  1. String? key, [
  2. String? defValue
])

Returns '' if key is null.

Implementation

static String getString(String? key, [String? defValue]) {
  if (key == null) {
    return '';
  }
  assert(_initCalled, 'Prefs.init() must be called first!');
  assert(_prefsInstance != null,
      'Maybe call Prefs.getStringF(key)instead. SharedPreferences not ready yet!');
  return _prefsInstance?.getString(key) ?? defValue ?? '';
}