baseRequest method

Future<String> baseRequest({
  1. Map<String, dynamic>? parameters,
  2. List<String> values = const [],
})

blueprint for a request, should called in the implementation of the formRequest method

Implementation

Future<String> baseRequest(
    {Map<String, dynamic>? parameters,
    List<String> values = const []}) async {
  parameters ??= {};
  if (appName != null) {
    parameters['app'] = appName;
  }
  if (appVersion != null) {
    parameters['version'] = appVersion;
  }
  if (values.isNotEmpty) {
    parameters['values'] = values.join(',');
  }
  String path = [apiPath, endpoint].join('/');
  Uri url = Uri.https(host, path, parameters);
  return await sendRequest(url);
}