getParam<T> method
Returns the named query parameter.
Throws ApiRequestException.badRequest if value does not exist or could
not be parsed.
If a null return value is preferred instead, simply set a nullable
type for T
and no exception will be thrown.
Valid types for T
(nullable, as well as non-nullable)
are String, int, double, bool, DateTime, Duration or Uint8List.
Implementation
T getParam<T>(String name) {
try {
return decodeTyped<T>(queryParams[name]);
} on CodecException catch (_) {
throw ApiRequestException.badRequest(
'Missing or malformed query parameter: $name');
}
}