getDouble static method

double getDouble(
  1. String key, [
  2. double defaultValue = 0.0
])

Get the data.

key: Key to get. defaultValue: Default value when there is no data.

Implementation

static double getDouble(String key, [double defaultValue = 0.0]) {
  if (!isInitialized) {
    debugPrint(
      "It has not been initialized. Please initialize it by executing [initialize()].",
    );
    return 0.0;
  }
  if (!containsKey(key)) {
    return defaultValue;
  }
  return _preferences?.getDouble(key) ?? defaultValue;
}