call method

Future<T?> call(
  1. Map<String, dynamic>? parameters
)

Implementation

Future<T?> call(Map<String, dynamic>? parameters) async {
  var needCall = true;
  Object? response;

  if (parameters != null && parameters.containsKey('SAMPLE')) {
    var sampleId = parameters['SAMPLE'];
    var sample = samples != null ? samples![sampleId] : null;

    print('SAMPLE: $sampleId');
    print(sample);

    needCall = false;
    response = sample;
  }

  if (needCall) {
    response = await httpConfig!.callAndResolve(parameters);
  }

  if (transformResponse != null) {
    response = transformResponse!(response);
  }

  if (jsonTransformer != null) {
    print('----------------------------------------------');
    print('jsonTransformer:');
    print(response);
    response = jsonTransformer!.transform(response);
    print(response);
    print('----------------------------------------------');
  }

  return response as FutureOr<T?>;
}