bindBody method

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

Binds the decoded body to the given instance.

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

decoded is the Map containing the decoded body. instance is the object to bind the decoded body 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); // Add all key-value pairs to the instance.
  } else if (instance is Bindable) {
    instance.bind(decoded);
  }
}