call method

Future<O?> call([
  1. Map<String, dynamic>? inputParameters,
  2. SysCallCallback<O?>? callback,
  3. SysProgressListener? onProgress
])

Executes the call using inputParameters (with fields specified at input) and calling callback after.

Implementation

Future<O?> call(
    [Map<String, dynamic>? inputParameters,
    SysCallCallback<O?>? callback,
    SysProgressListener? onProgress]) {
  if (executor == null) {
    var out = parseOutput(null);

    if (callback != null) {
      try {
        callback(out, inputParameters);
      } catch (e) {
        print(e);
      }
    }

    return Future.value(out);
  }

  var callParameters = buildCallParameters(inputParameters);

  var call = executor!.call(this, callParameters, onProgress);
  var calMapped = call.then(mapOutput);

  if (callback == null) return calMapped;

  return calMapped.then((out) {
    try {
      callback(out, inputParameters);
    } catch (e) {
      print(e);
    }
    return out;
  });
}