implement static method

NSURLAuthenticationChallengeSender implement({
  1. required void useCredential_forAuthenticationChallenge_(
    1. NSURLCredential,
    2. NSURLAuthenticationChallenge
    ),
  2. required void continueWithoutCredentialForAuthenticationChallenge_(
    1. NSURLAuthenticationChallenge
    ),
  3. required void cancelAuthenticationChallenge_(
    1. NSURLAuthenticationChallenge
    ),
  4. void performDefaultHandlingForAuthenticationChallenge_(
    1. NSURLAuthenticationChallenge
    )?,
  5. void rejectProtectionSpaceAndContinueWithChallenge_(
    1. NSURLAuthenticationChallenge
    )?,
  6. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSURLAuthenticationChallengeSender 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 NSURLAuthenticationChallengeSender implement({
  required void Function(NSURLCredential, NSURLAuthenticationChallenge)
  useCredential_forAuthenticationChallenge_,
  required void Function(NSURLAuthenticationChallenge)
  continueWithoutCredentialForAuthenticationChallenge_,
  required void Function(NSURLAuthenticationChallenge)
  cancelAuthenticationChallenge_,
  void Function(NSURLAuthenticationChallenge)?
  performDefaultHandlingForAuthenticationChallenge_,
  void Function(NSURLAuthenticationChallenge)?
  rejectProtectionSpaceAndContinueWithChallenge_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSURLAuthenticationChallengeSender',
  );
  NSURLAuthenticationChallengeSender.useCredential_forAuthenticationChallenge_
      .implement(builder, useCredential_forAuthenticationChallenge_);
  NSURLAuthenticationChallengeSender
      .continueWithoutCredentialForAuthenticationChallenge_
      .implement(
        builder,
        continueWithoutCredentialForAuthenticationChallenge_,
      );
  NSURLAuthenticationChallengeSender.cancelAuthenticationChallenge_.implement(
    builder,
    cancelAuthenticationChallenge_,
  );
  NSURLAuthenticationChallengeSender
      .performDefaultHandlingForAuthenticationChallenge_
      .implement(builder, performDefaultHandlingForAuthenticationChallenge_);
  NSURLAuthenticationChallengeSender
      .rejectProtectionSpaceAndContinueWithChallenge_
      .implement(builder, rejectProtectionSpaceAndContinueWithChallenge_);
  builder.addProtocol($protocol);
  return NSURLAuthenticationChallengeSender.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}