session property

Future<Session?> get session

The session for the given request.

Example:

server.get('/api/set/:item', (ctx) async {
  final Session session = await ctx.req.session;
  session['item'] = ctx.pathParams.item;
  // ...
});

Implementation

Future<Session?> get session async =>
    _session ??= await sessionManager?.parse(this);