LocaleResolutionContext class

Provides request-source lookups to locale resolvers.

A context keeps header, query, cookie, and optional session access behind a small synchronous interface. It does not choose a precedence order; the order is defined by the locale manager's resolver list.

final context = LocaleResolutionContext(
  header: (name) => requestHeaders[name],
  query: (name) => queryParameters[name],
  cookie: (name) => cookies[name],
);
final requested = context.query('lang');

Constructors

LocaleResolutionContext({required LocaleLookup header, required LocaleLookup query, required LocaleLookup cookie, LocaleLookup? sessionValue})
Creates a context with lookups for each request source.
LocaleResolutionContext.fromContext(EngineContext ctx)
Builds a context from the request represented by ctx.
factory

Properties

Looks up a request cookie by name.
final
hashCode → int
The hash code for this object.
no setterinherited
Looks up a request header by name.
final
query → LocaleLookup
Looks up a request query parameter by name.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sessionValue → LocaleLookup?
Looks up a value in the current session, when sessions are enabled.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited