implement static method

NSURLConnectionDownloadDelegate implement({
  1. void connection_didWriteData_totalBytesWritten_expectedTotalBytes_(
    1. NSURLConnection,
    2. DartNSInteger,
    3. DartNSInteger,
    4. DartNSInteger,
    )?,
  2. void connectionDidResumeDownloading_totalBytesWritten_expectedTotalBytes_(
    1. NSURLConnection,
    2. int,
    3. int
    )?,
  3. required void connectionDidFinishDownloading_destinationURL_(
    1. NSURLConnection,
    2. NSURL
    ),
  4. void connection_didFailWithError_(
    1. NSURLConnection,
    2. NSError
    )?,
  5. bool connectionShouldUseCredentialStorage_(
    1. NSURLConnection
    )?,
  6. void connection_willSendRequestForAuthenticationChallenge_(
    1. NSURLConnection,
    2. NSURLAuthenticationChallenge
    )?,
  7. bool connection_canAuthenticateAgainstProtectionSpace_(
    1. NSURLConnection,
    2. NSURLProtectionSpace
    )?,
  8. void connection_didReceiveAuthenticationChallenge_(
    1. NSURLConnection,
    2. NSURLAuthenticationChallenge
    )?,
  9. void connection_didCancelAuthenticationChallenge_(
    1. NSURLConnection,
    2. NSURLAuthenticationChallenge
    )?,
  10. bool $keepIsolateAlive = true,
})
override

Builds an object that implements the NSURLConnectionDownloadDelegate 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 NSURLConnectionDownloadDelegate implement({
  void Function(NSURLConnection, int, int, int)?
  connection_didWriteData_totalBytesWritten_expectedTotalBytes_,
  void Function(NSURLConnection, int, int)?
  connectionDidResumeDownloading_totalBytesWritten_expectedTotalBytes_,
  required void Function(NSURLConnection, objc.NSURL)
  connectionDidFinishDownloading_destinationURL_,
  void Function(NSURLConnection, objc.NSError)? connection_didFailWithError_,
  bool Function(NSURLConnection)? connectionShouldUseCredentialStorage_,
  void Function(NSURLConnection, NSURLAuthenticationChallenge)?
  connection_willSendRequestForAuthenticationChallenge_,
  bool Function(NSURLConnection, NSURLProtectionSpace)?
  connection_canAuthenticateAgainstProtectionSpace_,
  void Function(NSURLConnection, NSURLAuthenticationChallenge)?
  connection_didReceiveAuthenticationChallenge_,
  void Function(NSURLConnection, NSURLAuthenticationChallenge)?
  connection_didCancelAuthenticationChallenge_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSURLConnectionDownloadDelegate',
  );
  NSURLConnectionDownloadDelegate
      .connection_didWriteData_totalBytesWritten_expectedTotalBytes_
      .implement(
        builder,
        connection_didWriteData_totalBytesWritten_expectedTotalBytes_,
      );
  NSURLConnectionDownloadDelegate
      .connectionDidResumeDownloading_totalBytesWritten_expectedTotalBytes_
      .implement(
        builder,
        connectionDidResumeDownloading_totalBytesWritten_expectedTotalBytes_,
      );
  NSURLConnectionDownloadDelegate
      .connectionDidFinishDownloading_destinationURL_
      .implement(builder, connectionDidFinishDownloading_destinationURL_);
  NSURLConnectionDownloadDelegate.connection_didFailWithError_.implement(
    builder,
    connection_didFailWithError_,
  );
  NSURLConnectionDownloadDelegate.connectionShouldUseCredentialStorage_
      .implement(builder, connectionShouldUseCredentialStorage_);
  NSURLConnectionDownloadDelegate
      .connection_willSendRequestForAuthenticationChallenge_
      .implement(
        builder,
        connection_willSendRequestForAuthenticationChallenge_,
      );
  NSURLConnectionDownloadDelegate
      .connection_canAuthenticateAgainstProtectionSpace_
      .implement(builder, connection_canAuthenticateAgainstProtectionSpace_);
  NSURLConnectionDownloadDelegate
      .connection_didReceiveAuthenticationChallenge_
      .implement(builder, connection_didReceiveAuthenticationChallenge_);
  NSURLConnectionDownloadDelegate.connection_didCancelAuthenticationChallenge_
      .implement(builder, connection_didCancelAuthenticationChallenge_);
  builder.addProtocol($protocol);
  return NSURLConnectionDownloadDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}