startSessionDateForSession method

Future<DateTime?> startSessionDateForSession(
  1. int session
)

The date of start of a session. @param session The index of the session. @return The date when the session with the index has started, if no session is found this function returns null.

Implementation

Future<DateTime?> startSessionDateForSession(int session) async {
  SharedPreferences prefs = await SharedPreferences.getInstance();
  String key = _sessionDateKeyForSession(session);
  int? value = prefs.getInt(key);
  if (value != null && value != 0) {
    return DateTime.fromMillisecondsSinceEpoch(value);
  }
  return null;
}