addController method

void addController(
  1. DartnessController controller
)

Add controller into Dartness and handles the methods annotated with Bind children to Controller and Bind.method.

In order to add the controller the class must be annotated with Controller

Just the methods that are annotated with any Bind annotation will be handled.

If the Bind annotation in the method is Get the method will also be called for Head requests matching Bind.method. This is because handling Get requests without handling Head is always wrong. To explicitly implement a Head handler the method must be created before the Get handler.

throws ArgumentError if controller is not annotated with Controller

Implementation

void addController(final DartnessController controller) {
  _server.addController(controller);
}