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

method → String
final
pathVariables → List<String>
Returns a list of all path variables required for this operation.
read-only
hashCode → int
The hash code for this object.
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited