implementAsBlocking static method

NSURLAuthenticationChallengeSender implementAsBlocking({
  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. All methods that can be implemented as blocking listeners will be.

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

Implementation

static NSURLAuthenticationChallengeSender implementAsBlocking({
  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_
      .implementAsBlocking(
        builder,
        useCredential_forAuthenticationChallenge_,
      );
  NSURLAuthenticationChallengeSender
      .continueWithoutCredentialForAuthenticationChallenge_
      .implementAsBlocking(
        builder,
        continueWithoutCredentialForAuthenticationChallenge_,
      );
  NSURLAuthenticationChallengeSender.cancelAuthenticationChallenge_
      .implementAsBlocking(builder, cancelAuthenticationChallenge_);
  NSURLAuthenticationChallengeSender
      .performDefaultHandlingForAuthenticationChallenge_
      .implementAsBlocking(
        builder,
        performDefaultHandlingForAuthenticationChallenge_,
      );
  NSURLAuthenticationChallengeSender
      .rejectProtectionSpaceAndContinueWithChallenge_
      .implementAsBlocking(
        builder,
        rejectProtectionSpaceAndContinueWithChallenge_,
      );
  builder.addProtocol($protocol);
  return NSURLAuthenticationChallengeSender.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}