Context class

Unified request context for HTTP and WebSocket routes.

Example:

app.get('/hello', (ctx) {
  ctx.res?.json({'message': 'hello'});
});

app.websocket('/chat', (ctx) {
  ctx.socket?.on('ping', (_) => ctx.socket?.emit('pong', {}));
});

Constructors

Context({required Request req, Response? res, FlintWebSocket? socket, Map<Object, Object?>? extras})

Properties

ai FlintAi
no setter
extras Map<Object, Object?>
final
hashCode int
The hash code for this object.
no setterinherited
isHttp bool
no setter
isWebSocket bool
no setter
req Request
final
res Response?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
socket FlintWebSocket?
final

Methods

getExtra<T>(Object key) → T?
hasExtra(Object key) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read<T>() → T?
Type-keyed storage for future session/user injection patterns.
setExtra(Object key, Object? value) → void
toString() String
A string representation of this object.
inherited
write<T>(T value) → void
Type-keyed storage for future session/user injection patterns.

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](Object key) Object?
operator []=(Object key, Object? value) → void