bindBody method

Future<void> bindBody(
  1. Map<String, dynamic> decoded,
  2. dynamic instance
)

Binds the decoded JSON body to an instance.

This method adds all key-value pairs from the decoded JSON to the provided instance if the instance is a Map or implements Bindable.

decoded - The decoded JSON body as a Map. instance - The instance to bind the JSON data to.

Returns a Future that completes when binding is done.

Implementation

Future<void> bindBody(Map<String, dynamic> decoded, dynamic instance) async {
  if (instance is Map) {
    instance.addAll(decoded);
  } else if (instance is Bindable) {
    instance.bind(decoded);
  }
}