bind<T> method
Binds the JSON body of the request to an instance.
This method first decodes the JSON body using _decodedBody, then binds the decoded
JSON to the provided instance. If validation rules are provided, it validates the JSON
body before binding.
context - The EngineContext containing the request information.
instance - The instance to bind the JSON data to.
rules - An optional Map of validation rules to apply to the JSON body.
Returns a Future that completes when binding is done.
Implementation
@override
Future<T> bind<T>(
EngineContext context,
T instance, {
Map<String, String>? rules,
}) async {
final decoded = await _decodedBody(context);
await bindBody(decoded, instance);
return instance;
}