RouteHandler<RespType> typedef Null safety

RouteHandler<RespType> = FutureOr<RespType> Function(Context context)

Prototype for Route handler. A route handler is a function that shall be invoked when a HTTP request with matching path is received.

The context parameter contains information about the request. The route handler is expected to process the request and return the response or result of type RespType. Alternatively, one can set the response using response member of context.


typedef FutureOr<RespType> RouteHandler<RespType>(Context context);