deleteSession function

String deleteSession(
  1. String currentContent,
  2. String startTime
)

Deletes a session with the given start time from the TTL content.

Implementation

String deleteSession(String currentContent, String startTime) {
  List<Map<String, String>> sessions = parseSessions(currentContent);
  sessions.removeWhere((s) => s['start'] == startTime);
  return serializeSessions(sessions);
}