App class
The main entry point for a Kronix application.
The App class manages the HTTP server lifecycle, routing registration, and the global middleware pipeline.
- Available extensions
Properties
- activeHttpRequests → int
-
Returns the number of active HTTP requests.
no setter
- activeRequests → int
-
Returns the total number of active connections (HTTP + WebSocket).
no setter
- activeWebSockets → int
-
Returns the number of active WebSocket connections.
no setter
- exceptionHandler ↔ ExceptionHandler
-
The global exception handler used to transform errors into responses.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- router → Router
-
Provides access to the Router instance for manual route manipulation.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- wsHub → WebSocketHub
-
Provides access to the global WebSocketHub.
no setter
Methods
-
delete(
String path, Handler handler, {List< Middleware> middleware = const [], String? name}) → RouteData - Registers a DELETE route.
-
get(
String path, Handler handler, {List< Middleware> middleware = const [], String? name}) → RouteData - Registers a GET route.
-
group(
String prefix, {List< Middleware> middleware = const [], required void callback(Router)}) → void -
Groups routes under a common
prefixwith optionalmiddleware. -
head(
String path, Handler handler, {List< Middleware> middleware = const [], String? name}) → RouteData - Registers a HEAD route.
-
listen(
{int? port, String? host}) → Future< void> - Starts the HTTP/WebSocket server and listens for incoming requests.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
options(
String path, Handler handler, {List< Middleware> middleware = const [], String? name}) → RouteData - Registers an OPTIONS route.
-
patch(
String path, Handler handler, {List< Middleware> middleware = const [], String? name}) → RouteData - Registers a PATCH route.
-
post(
String path, Handler handler, {List< Middleware> middleware = const [], String? name}) → RouteData - Registers a POST route.
-
put(
String path, Handler handler, {List< Middleware> middleware = const [], String? name}) → RouteData - Registers a PUT route.
-
stop(
{bool force = false}) → Future< void> - Stops the server and releases all bound resources.
-
test(
) → TestClient -
Available on App, provided by the AppTestExtension extension
Returns a TestClient instance for the current App. -
toString(
) → String -
A string representation of this object.
inherited
-
use(
Middleware middleware) → void -
Registers a global
middlewareto be executed for every request. -
usePlugin(
Plugin plugin) → void -
Available on App, provided by the AppPluginExtension extension
Registers apluginwith the current application. -
ws(
String path, WebSocketHandler handler, {List< Middleware> middleware = const [], String? name}) → RouteData -
Registers a WebSocket endpoint at the specified
path.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited