query property Null safety

QueryParams query

Returns query parameters of the request

Lazily creates query parameters to enhance performance of route handling.

Example:

server.get('/api/quote', (ctx) {
  final int index = ctx.query.getInt('index', 1); // The magic!
  return quotes[index + 1];
});

Implementation

QueryParams get query => _query ??= QueryParams(req.uri.queryParameters);