implementAsBlocking static method
NSURLConnectionDelegate
implementAsBlocking({
- void connection_didFailWithError_(
- NSURLConnection,
- NSError
- bool connectionShouldUseCredentialStorage_()?,
- void connection_willSendRequestForAuthenticationChallenge_()?,
- bool connection_canAuthenticateAgainstProtectionSpace_()?,
- void connection_didReceiveAuthenticationChallenge_()?,
- void connection_didCancelAuthenticationChallenge_()?,
- bool $keepIsolateAlive = true,
Builds an object that implements the NSURLConnectionDelegate 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 NSURLConnectionDelegate implementAsBlocking({
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: 'NSURLConnectionDelegate',
);
NSURLConnectionDelegate.connection_didFailWithError_.implementAsBlocking(
builder,
connection_didFailWithError_,
);
NSURLConnectionDelegate.connectionShouldUseCredentialStorage_.implement(
builder,
connectionShouldUseCredentialStorage_,
);
NSURLConnectionDelegate
.connection_willSendRequestForAuthenticationChallenge_
.implementAsBlocking(
builder,
connection_willSendRequestForAuthenticationChallenge_,
);
NSURLConnectionDelegate.connection_canAuthenticateAgainstProtectionSpace_
.implement(builder, connection_canAuthenticateAgainstProtectionSpace_);
NSURLConnectionDelegate.connection_didReceiveAuthenticationChallenge_
.implementAsBlocking(
builder,
connection_didReceiveAuthenticationChallenge_,
);
NSURLConnectionDelegate.connection_didCancelAuthenticationChallenge_
.implementAsBlocking(
builder,
connection_didCancelAuthenticationChallenge_,
);
builder.addProtocol($protocol);
return NSURLConnectionDelegate.castFrom(
builder.build(keepIsolateAlive: $keepIsolateAlive),
);
}