bindings library
Request binding utilities for Routed.
Import this when you need to bind request payloads (JSON, forms, query parameters) to data classes.
Classes
- Binding
-
The
Bindinginterface, analogous to Gin's "Binding". This interface defines the contract for binding and validating request data. - FormBinding
- A class that handles form binding and validation.
- JsonBinding
- A class that handles JSON binding and validation for incoming requests.
- MultipartBinding
- A binding for handling multipart form data.
- QueryBinding
- A class that handles the binding and validation of query parameters.
-
QueryDecodable<
T> - (Optional) Interface for objects that know how to decode themselves from a map of query parameters. This can be used in more advanced scenarios.
- QueryEncodable
- Interface for objects that know how to encode themselves to query parameters.
- QueryParamsCodec
- A codec that encodes and decodes query strings with special handling for objects that implement QueryEncodable.
- QueryParamsDecoder
-
Decodes a query string (e.g. "?foo=bar&num=42&...") into a
Map<String, dynamic>. This class extends the Converter class to provide a custom implementation for decoding query strings into a map. - QueryParamsEncoder
-
Encodes a
Map<String, dynamic>into a query string, but first recursively converts objects that implement QueryEncodable viatoQuery(). - UriBinding
- A class that binds URI parameters to a given instance and validates them.
Enums
- MimeType
- Common MIME types (mirroring Gin's constants). These are used to determine the type of data in the request body.
Properties
- formBinding → FormBinding
-
final
- jsonBinding → JsonBinding
-
final
- multipartBinding → MultipartBinding
-
final
- queryBinding → QueryBinding
-
final
- uriBinding → UriBinding
-
final
Functions
-
defaultBinding(
String method, String contentType) → Binding -
Return a default binding given
methodandcontentType.