startWithCompletionBlockWithSuccess method

void startWithCompletionBlockWithSuccess(
  1. MCBatchCallback success
)

Implementation

void startWithCompletionBlockWithSuccess(MCBatchCallback success) async {
  for (MCRequestAccessory item in _requestAccessories) {
    item.requestWillStart();
  }
  for (MCBaseRequest request in this._requestArray) {
    request.startWithCompletionBlockWithSuccess((MCRequestData? data) {
      this.successRequest.add(data);
      _currentEnd++;
      if (_currentEnd == this._requestArray.length && _isStop == false) {
        // print("完成请求${_currentEnd}");
        success(this.successRequest, this.failureRequest);
        for (MCRequestAccessory item in _requestAccessories) {
          item.requestDidStop();
        }
      }
    }, (MCRequestData? error) {
      this.failureRequest.add(error);
      _currentEnd++;
      if (_currentEnd == this._requestArray.length && _isStop == false) {
        // print("完成请求${_currentEnd}");
        success(this.successRequest, this.failureRequest);
        for (MCRequestAccessory item in _requestAccessories) {
          item.requestDidStop();
        }
      }
    });
  }
}