getSession static method

Session? getSession(
  1. Request request
)

Returns the session for the specified request, if it was previously created; otherwise returns null.

Implementation

static Session? getSession(Request request) {
  final sessionId = _getSessionId(request);
  final now = DateTime.now();
  _sessions.removeWhere((k, v) => v.expires.compareTo(now) < 0);
  return _sessions[sessionId];
}