request method

void request(
  1. int id, {
  2. String? apiName,
  3. Object? body,
  4. required String method,
  5. required String path,
  6. Map<String, String?>? parameters,
})

Implementation

void request(
  int id, {
  String? apiName,
  Object? body,
  required String method,
  required String path,
  Map<String, String?>? parameters,
}) {
  var request = NetworkRequest(id,
      apiName: apiName,
      requestBody: body,
      httpMethod: method,
      path: path,
      parameters: parameters ?? {});

  var requestList = requests.value..add(request);

  if (requestList.length > _maxRequest) {
    requestList.removeAt(0);
  }

  requests.add(requestList);
}