host property

String? host
finalinherited

The virtual host this route will respond to.

When null (the default), the route matches requests to any host. When set, the route only matches requests where the Host header matches this value exactly.

Example:

// Route that only responds to api.example.com
class ApiRoute extends Route {
  ApiRoute() : super(host: 'api.example.com');
  // ...
}

// Route that responds to any host (default)
class PublicRoute extends Route {
  PublicRoute() : super();  // host defaults to null
  // ...
}

Implementation

final String? host;