Controller class final

Marks a class as an HTTP controller.

The path is relative. A controller does not know where it is mounted, so a version prefix is written once at the composition site and the same controller can be mounted more than once.

@Controller('/todos', tags: ['todos'])
class TodoController with _$TodoController {
  TodoController(this._repo);

  final TodoRepo _repo;
}
Annotations
  • @Target.new({TargetKind.classType})

Constructors

Controller(String path, {List<String> tags = const [], List<Object> middleware = const []})
Declares a controller rooted at path.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
middleware List<Object>
Middleware applied to every handler in the class.
final
path String
The path prefix shared by every handler in the class.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tags List<String>
Tags inherited by every handler, for documentation tooling.
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