makeRemoteFunctionRequest method

RemoteFunctionRequest makeRemoteFunctionRequest(
  1. String futureIdentifier,
  2. List parameters
)

Implementation

RemoteFunctionRequest makeRemoteFunctionRequest(String futureIdentifier, List<dynamic> parameters)
{
    RemoteFunctionRequest request = new RemoteFunctionRequest();

    request.remoteFunctionIdentifier = this._remoteFunctionIdentifier;
    request.remoteFutureIdentifier = futureIdentifier;

    // We want to use the mutator to convert each parameter to a Blob.
    // However, Mutator expects a DataPackage to set the blob directly.
    // Hence, we create a stub data package and simply retrieve it's payload,
    // after the mutator has converted and set the blob.
    DataPackage stubPackage = new DataPackage();

    for(int i = 0; i < parameters.length; i++)
    {
        Mutator mutator = TypeMapping().getMutator(_parameterTypes[i]);

        mutator.setter(stubPackage, parameters[i]);
        request.parameterPayloads.add(stubPackage.payload);
    }

    return request;
}