implement static method

NSURLDownloadDelegate implement({
  1. void downloadDidBegin_(
    1. NSURLDownload
    )?,
  2. NSURLRequest? download_willSendRequest_redirectResponse_(
    1. NSURLDownload,
    2. NSURLRequest,
    3. NSURLResponse?
    )?,
  3. bool download_canAuthenticateAgainstProtectionSpace_(
    1. NSURLDownload,
    2. NSURLProtectionSpace
    )?,
  4. void download_didReceiveAuthenticationChallenge_(
    1. NSURLDownload,
    2. NSURLAuthenticationChallenge
    )?,
  5. void download_didCancelAuthenticationChallenge_(
    1. NSURLDownload,
    2. NSURLAuthenticationChallenge
    )?,
  6. bool downloadShouldUseCredentialStorage_(
    1. NSURLDownload
    )?,
  7. void download_didReceiveResponse_(
    1. NSURLDownload,
    2. NSURLResponse
    )?,
  8. void download_willResumeWithResponse_fromByte_(
    1. NSURLDownload,
    2. NSURLResponse,
    3. int
    )?,
  9. void download_didReceiveDataOfLength_(
    1. NSURLDownload,
    2. DartNSUInteger
    )?,
  10. bool download_shouldDecodeSourceDataOfMIMEType_(
    1. NSURLDownload,
    2. NSString
    )?,
  11. void download_decideDestinationWithSuggestedFilename_(
    1. NSURLDownload,
    2. NSString
    )?,
  12. void download_didCreateDestination_(
    1. NSURLDownload,
    2. NSString
    )?,
  13. void downloadDidFinish_(
    1. NSURLDownload
    )?,
  14. void download_didFailWithError_(
    1. NSURLDownload,
    2. NSError
    )?,
  15. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSURLDownloadDelegate protocol. To implement multiple protocols, use addToBuilder or objc.ObjCProtocolBuilder directly.

If $keepIsolateAlive is true, this protocol will keep this isolate alive until it is garbage collected by both Dart and ObjC.

Implementation

static NSURLDownloadDelegate implement({
  void Function(NSURLDownload)? downloadDidBegin_,
  NSURLRequest? Function(NSURLDownload, NSURLRequest, NSURLResponse?)?
  download_willSendRequest_redirectResponse_,
  bool Function(NSURLDownload, NSURLProtectionSpace)?
  download_canAuthenticateAgainstProtectionSpace_,
  void Function(NSURLDownload, NSURLAuthenticationChallenge)?
  download_didReceiveAuthenticationChallenge_,
  void Function(NSURLDownload, NSURLAuthenticationChallenge)?
  download_didCancelAuthenticationChallenge_,
  bool Function(NSURLDownload)? downloadShouldUseCredentialStorage_,
  void Function(NSURLDownload, NSURLResponse)? download_didReceiveResponse_,
  void Function(NSURLDownload, NSURLResponse, int)?
  download_willResumeWithResponse_fromByte_,
  void Function(NSURLDownload, DartNSUInteger)?
  download_didReceiveDataOfLength_,
  bool Function(NSURLDownload, objc.NSString)?
  download_shouldDecodeSourceDataOfMIMEType_,
  void Function(NSURLDownload, objc.NSString)?
  download_decideDestinationWithSuggestedFilename_,
  void Function(NSURLDownload, objc.NSString)? download_didCreateDestination_,
  void Function(NSURLDownload)? downloadDidFinish_,
  void Function(NSURLDownload, objc.NSError)? download_didFailWithError_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSURLDownloadDelegate',
  );
  NSURLDownloadDelegate.downloadDidBegin_.implement(
    builder,
    downloadDidBegin_,
  );
  NSURLDownloadDelegate.download_willSendRequest_redirectResponse_.implement(
    builder,
    download_willSendRequest_redirectResponse_,
  );
  NSURLDownloadDelegate.download_canAuthenticateAgainstProtectionSpace_
      .implement(builder, download_canAuthenticateAgainstProtectionSpace_);
  NSURLDownloadDelegate.download_didReceiveAuthenticationChallenge_.implement(
    builder,
    download_didReceiveAuthenticationChallenge_,
  );
  NSURLDownloadDelegate.download_didCancelAuthenticationChallenge_.implement(
    builder,
    download_didCancelAuthenticationChallenge_,
  );
  NSURLDownloadDelegate.downloadShouldUseCredentialStorage_.implement(
    builder,
    downloadShouldUseCredentialStorage_,
  );
  NSURLDownloadDelegate.download_didReceiveResponse_.implement(
    builder,
    download_didReceiveResponse_,
  );
  NSURLDownloadDelegate.download_willResumeWithResponse_fromByte_.implement(
    builder,
    download_willResumeWithResponse_fromByte_,
  );
  NSURLDownloadDelegate.download_didReceiveDataOfLength_.implement(
    builder,
    download_didReceiveDataOfLength_,
  );
  NSURLDownloadDelegate.download_shouldDecodeSourceDataOfMIMEType_.implement(
    builder,
    download_shouldDecodeSourceDataOfMIMEType_,
  );
  NSURLDownloadDelegate.download_decideDestinationWithSuggestedFilename_
      .implement(builder, download_decideDestinationWithSuggestedFilename_);
  NSURLDownloadDelegate.download_didCreateDestination_.implement(
    builder,
    download_didCreateDestination_,
  );
  NSURLDownloadDelegate.downloadDidFinish_.implement(
    builder,
    downloadDidFinish_,
  );
  NSURLDownloadDelegate.download_didFailWithError_.implement(
    builder,
    download_didFailWithError_,
  );
  builder.addProtocol($protocol);
  return NSURLDownloadDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}