getEntry function

EphemeralTelemetry getEntry(
  1. double index
)

Implementation

EphemeralTelemetry getEntry(double index) {
  if (prefs.getString("userEntry_EphemeralData$index") != null) {
    Map<String, dynamic> jsonData =
        jsonDecode(prefs.getString("userEntry_EphemeralData$index")!);
    return EphemeralTelemetry(index,
        moodScale: jsonData["moodScale"] as int,
        briefNote: jsonData["briefNote"].toString(),
        hoursOfSleep: jsonData["hoursOfSleep"] as int,
        entryTime: jsonData["entryTimeEpochMS"] as int,
        emotionTags: jsonData["emotionTags"].toString(),
        stressorsOfToday: jsonData["stressorsOfToday"].toString(),
        hoursOnScreen: jsonData["hoursOnScreen"] as int,
        hoursExercising: jsonData["hoursExercising"] as int,
        howStressed: jsonData["howStressed"] as int,
        hoursSpentWithFamily: jsonData["hoursSpentWithFamily"] as int,
        sleepRating: jsonData["sleepRating"] as int);
  }
  return EphemeralTelemetry(index);
}