send method

Future<MFResponse> send (
  1. {Map<String, dynamic> json,
  2. Map<String, String> formParameters,
  3. String requestBody}
)

Implementation

Future<MFResponse> send(
    {Map<String, dynamic> json,
    Map<String, String> formParameters,
    String requestBody}) async {
  Map response;
  if (json != null) {
    response = await _channel.invokeMethod(WLRESOURCEREQUEST_SEND_JSON,
        <String, dynamic>{UUID: _uuid, JSON: json});
  } else if (formParameters != null) {
    response = await _channel.invokeMethod(WLRESOURCEREQUEST_SEND_FORM_PARAMS,
        <String, dynamic>{UUID: _uuid, PARAMETERS: formParameters});
  } else if (requestBody != null) {
    response = await _channel.invokeMethod(
        WLRESOURCEREQUEST_SEND_REQUEST_BODY,
        <String, dynamic>{UUID: _uuid, BODY: requestBody});
  } else {
    response = await _channel
        .invokeMethod(WLRESOURCEREQUEST_SEND, <String, dynamic>{UUID: _uuid});
  }
  final MFResponse mfResponse = MFResponse(mfResponse: response);
  if (mfResponse.errorMsg?.isEmpty ?? true) {
    return mfResponse;
  } else {
    throw mfResponse;
  }
}