markSessionEnd function
Implementation
Future<void> markSessionEnd() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
if (prefs.getString("app_state") == 'resumed') {
var sessionEnd = DateTime.now().millisecondsSinceEpoch;
await prefs.setInt("session-end", sessionEnd);
await prefs.setString("app_state", "inactive");
}
}