sessionContext function
Returns the SessionController for the current request.
Throws StateError if sessionMiddleware was not registered.
Implementation
SessionController sessionContext(Context c) {
final ctrl = c.get<SessionController?>(_sessionCtrlKey);
if (ctrl == null) {
throw StateError(
'sessionContext() called without sessionMiddleware. '
'Register app.use(sessionMiddleware(...)) before using sessions.',
);
}
return ctrl;
}