PrfString constructor

PrfString(
  1. String key, {
  2. String? defaultValue,
})

Creates a new string preference variable with the specified key.

The optional defaultValue is returned if the preference is not found or if an error occurs while reading.

Implementation

PrfString(String key, {String? defaultValue})
    : super(
        key,
        (prefs, key) async => await prefs.getString(key),
        (prefs, key, value) async => await prefs.setString(key, value),
        defaultValue,
      );