route method Null safety

Route route(
  1. String path,
  2. RouteHandler handler,
  3. {Map<String, String>? pathRegEx,
  4. List<String> methods = const <String>['GET', 'PUT', 'POST', 'DELETE'],
  5. int statusCode = 200,
  6. String? mimeType,
  7. String? charset = kDefaultCharset,
  8. ResponseProcessor? responseProcessor,
  9. List<RouteInterceptor>? after,
  10. List<RouteInterceptor>? before,
  11. List<ExceptionHandler>? onException}
)

Adds a route to be served

Implementation

Route route(String path, RouteHandler handler,
    {Map<String, String>? pathRegEx,
    List<String> methods = const <String>['GET', 'PUT', 'POST', 'DELETE'],
    int statusCode = 200,
    String? mimeType,
    String? charset = kDefaultCharset,
    ResponseProcessor? responseProcessor,
    List<RouteInterceptor>? after,
    List<RouteInterceptor>? before,
    List<ExceptionHandler>? onException}) {
  final route = Route(path, handler,
      methods: methods,
      pathRegEx: pathRegEx,
      statusCode: statusCode,
      mimeType: mimeType,
      charset: charset,
      responseProcessor: responseProcessor,
      before: before,
      after: after,
      onException: onException);
  return addRoute(route);
}