read method

Future<StepData> read()

Implementation

Future<StepData> read() async {
  if (needReload()) {
    await reload();
  }
  SharedPreferences preferences = await SharedPreferences.getInstance();
  String? value = preferences.getString(storageKey);
  if (value == null) {
    return StepData.empty();
  } else {
    return StepData.fromJson(jsonDecode(value));
  }
}