fromCookie method

Future<Session> fromCookie(
  1. String? cookie
)

The session of cookie: the session cookie value as the browser sent it (still encrypted). For code with no request, like a socket. It has the same checks as this middleware: a changed or foreign cookie, a cookie made with another key, an expired session or an unknown id gives an empty session. Changes to it are not saved.

Session session = await SessionMiddleware().fromCookie(raw);
session.get('auth_web');

Implementation

Future<Session> fromCookie(String? cookie) {
  SessionConfig config = this.config;
  String? value = cookie == null
      ? null
      : DoxCookie.decrypt(config.cookie, cookie);
  return _load(value, config);
}