Controller class abstract

Base controller class for handling HTTP requests.

Provides convenient access to request and response objects, as well as helper methods for common tasks like sending JSON responses, rendering views, and validating input.

Constructors

Controller()

Properties

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

Methods

json(Map<String, dynamic> data, {int status = 200}) → void
Sends a JSON response.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerRoutes(Router router) → void
Registers routes for this controller.
send(String text, {int status = 200}) → void
Sends a plain text response.
toString() String
A string representation of this object.
inherited
validate(Map<String, String> rules, {Map<String, String> messages = const {}}) Future<Map<String, dynamic>>
Validates the request input.
view(String name, [Map<String, dynamic> data = const {}]) Future<void>
Renders a view.

Operators

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