implement static method

NSURLConnectionDataDelegate implement({
  1. NSURLRequest? connection_willSendRequest_redirectResponse_(
    1. NSURLConnection,
    2. NSURLRequest,
    3. NSURLResponse?
    )?,
  2. void connection_didReceiveResponse_(
    1. NSURLConnection,
    2. NSURLResponse
    )?,
  3. void connection_didReceiveData_(
    1. NSURLConnection,
    2. NSData
    )?,
  4. NSInputStream? connection_needNewBodyStream_(
    1. NSURLConnection,
    2. NSURLRequest
    )?,
  5. void connection_didSendBodyData_totalBytesWritten_totalBytesExpectedToWrite_(
    1. NSURLConnection,
    2. DartNSInteger,
    3. DartNSInteger,
    4. DartNSInteger,
    )?,
  6. NSCachedURLResponse? connection_willCacheResponse_(
    1. NSURLConnection,
    2. NSCachedURLResponse
    )?,
  7. void connectionDidFinishLoading_(
    1. NSURLConnection
    )?,
  8. void connection_didFailWithError_(
    1. NSURLConnection,
    2. NSError
    )?,
  9. bool connectionShouldUseCredentialStorage_(
    1. NSURLConnection
    )?,
  10. void connection_willSendRequestForAuthenticationChallenge_(
    1. NSURLConnection,
    2. NSURLAuthenticationChallenge
    )?,
  11. bool connection_canAuthenticateAgainstProtectionSpace_(
    1. NSURLConnection,
    2. NSURLProtectionSpace
    )?,
  12. void connection_didReceiveAuthenticationChallenge_(
    1. NSURLConnection,
    2. NSURLAuthenticationChallenge
    )?,
  13. void connection_didCancelAuthenticationChallenge_(
    1. NSURLConnection,
    2. NSURLAuthenticationChallenge
    )?,
  14. bool $keepIsolateAlive = true,
})
override

Builds an object that implements the NSURLConnectionDataDelegate 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 NSURLConnectionDataDelegate implement({
  NSURLRequest? Function(NSURLConnection, NSURLRequest, NSURLResponse?)?
  connection_willSendRequest_redirectResponse_,
  void Function(NSURLConnection, NSURLResponse)?
  connection_didReceiveResponse_,
  void Function(NSURLConnection, objc.NSData)? connection_didReceiveData_,
  objc.NSInputStream? Function(NSURLConnection, NSURLRequest)?
  connection_needNewBodyStream_,
  void Function(NSURLConnection, DartNSInteger, DartNSInteger, DartNSInteger)?
  connection_didSendBodyData_totalBytesWritten_totalBytesExpectedToWrite_,
  NSCachedURLResponse? Function(NSURLConnection, NSCachedURLResponse)?
  connection_willCacheResponse_,
  void Function(NSURLConnection)? connectionDidFinishLoading_,
  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: 'NSURLConnectionDataDelegate',
  );
  NSURLConnectionDataDelegate.connection_willSendRequest_redirectResponse_
      .implement(builder, connection_willSendRequest_redirectResponse_);
  NSURLConnectionDataDelegate.connection_didReceiveResponse_.implement(
    builder,
    connection_didReceiveResponse_,
  );
  NSURLConnectionDataDelegate.connection_didReceiveData_.implement(
    builder,
    connection_didReceiveData_,
  );
  NSURLConnectionDataDelegate.connection_needNewBodyStream_.implement(
    builder,
    connection_needNewBodyStream_,
  );
  NSURLConnectionDataDelegate
      .connection_didSendBodyData_totalBytesWritten_totalBytesExpectedToWrite_
      .implement(
        builder,
        connection_didSendBodyData_totalBytesWritten_totalBytesExpectedToWrite_,
      );
  NSURLConnectionDataDelegate.connection_willCacheResponse_.implement(
    builder,
    connection_willCacheResponse_,
  );
  NSURLConnectionDataDelegate.connectionDidFinishLoading_.implement(
    builder,
    connectionDidFinishLoading_,
  );
  NSURLConnectionDataDelegate.connection_didFailWithError_.implement(
    builder,
    connection_didFailWithError_,
  );
  NSURLConnectionDataDelegate.connectionShouldUseCredentialStorage_.implement(
    builder,
    connectionShouldUseCredentialStorage_,
  );
  NSURLConnectionDataDelegate
      .connection_willSendRequestForAuthenticationChallenge_
      .implement(
        builder,
        connection_willSendRequestForAuthenticationChallenge_,
      );
  NSURLConnectionDataDelegate
      .connection_canAuthenticateAgainstProtectionSpace_
      .implement(builder, connection_canAuthenticateAgainstProtectionSpace_);
  NSURLConnectionDataDelegate.connection_didReceiveAuthenticationChallenge_
      .implement(builder, connection_didReceiveAuthenticationChallenge_);
  NSURLConnectionDataDelegate.connection_didCancelAuthenticationChallenge_
      .implement(builder, connection_didCancelAuthenticationChallenge_);
  builder.addProtocol($protocol);
  return NSURLConnectionDataDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}