Operation class

Binds an instance method in ResourceController to an operation.

An operation is a request method (e.g., GET, POST) and a list of path variables. A ResourceController implements an operation method for each operation it handles (e.g., GET /users/:id, POST /users). A method with this annotation will be invoked when a ResourceController handles a request where method matches the request's method and all pathVariables are present in the request's path. For example:

    class MyController extends ResourceController {
      @Operation.get('id')
      Future<Response> getOne(@Bind.path('id') int id) async {
        return Response.ok(objects[id]);
      }
    }

Constructors

Operation(String method, [String? pathVariable1, String? pathVariable2, String? pathVariable3, String? pathVariable4])
const
Operation.delete([String? pathVariable1, String? pathVariable2, String? pathVariable3, String? pathVariable4])
const
Operation.get([String? pathVariable1, String? pathVariable2, String? pathVariable3, String? pathVariable4])
const
Operation.post([String? pathVariable1, String? pathVariable2, String? pathVariable3, String? pathVariable4])
const
Operation.put([String? pathVariable1, String? pathVariable2, String? pathVariable3, String? pathVariable4])
const

Properties

hashCode int
The hash code for this object.
no setterinherited
method String
final
pathVariables List<String>
Returns a list of all path variables required for this operation.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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