Controller class

Base controller class for handling HTTP requests in the web application. Controller serves as the foundation for all request handlers in the framework. It provides access to the current request context and implements the RouteRepos interface for standardized request handling. Controllers are typically used to organize related request handling logic and can be associated with routes to process incoming HTTP requests. the rq getter, is RequestContext.rq to access the current WebRequest. This design leverages the Zone-based Context system for thread-safe request handling.

  • Thread-safe request handling through Zone isolation
  • Standardized interface for index route handling
  • Built-in string representation for debugging and introspection Example usage: @override Future<String> index() async { final users = await userService.getAllUsers(); return rq.renderJson(users); } Future<String> show() async { } } WebRoute( path: '/users',
Implemented types
Implementers

Constructors

Controller()

Properties

hashCode int
The hash code for this object.
no setterinherited
rq Request
Gets the current WebRequest from the request context
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

index() Future<String>
Provides an asynchronous method for rendering the index page of the controller.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString({bool short = false}) String
Returns a string representation of the controller.
override

Operators

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