getDouble static method

double getDouble(
  1. String key, {
  2. double defaultValue = 0.0,
})

获取双精度浮点数

keydefaultValue 未找到时的默认值,默认为 0.0

示例:

double salary = SharepUtil.getDouble('salary', defaultValue: 8888.8);
print(salary); // 例如: 8888.8

返回结果: double 读取到的值

Implementation

static double getDouble(String key, {double defaultValue = 0.0}) {
  return _prefs?.getDouble(key) ?? defaultValue;
}