getString function

  1. @Deprecated('Use getStringAsync instead without using await')
Future<String> getString(
  1. String key, {
  2. dynamic defaultValue = '',
})

Returns a String if exists in SharedPref

Implementation

@Deprecated('Use getStringAsync instead without using await')
Future<String> getString(String key, {defaultValue = ''}) async {
  return await getSharedPref().then((pref) {
    return pref.getString(key) ?? defaultValue;
  });
}