getDouble method

Future<double> getDouble(
  1. String key
)

Retrieves a double value from SharedPreferences.

Returns the default value if the key does not exist.

  • key: The key for the double value to be retrieved.

Implementation

Future<double> getDouble(String key) async {
  await ensureSharedPrefIsInitialized();
  if (doubleKeys.containsKey(key)) {
    return prefs.getDouble(key) ?? doubleKeys[key]!;
  } else {
    throw Exception("Key '$key' is not implemented as double.");
  }
}