implement static method
NSURLSessionDelegate
implement({
- void URLSession_didBecomeInvalidWithError_(
- NSURLSession,
- NSError?
- void URLSession_didReceiveChallenge_completionHandler_(
- NSURLSession,
- NSURLAuthenticationChallenge,
- ObjCBlock<
Void Function(NSInteger, NSURLCredential?)>
- void URLSessionDidFinishEventsForBackgroundURLSession_()?,
- bool $keepIsolateAlive = true,
Builds an object that implements the NSURLSessionDelegate 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 NSURLSessionDelegate implement({
void Function(NSURLSession, objc.NSError?)?
URLSession_didBecomeInvalidWithError_,
void Function(
NSURLSession,
NSURLAuthenticationChallenge,
objc.ObjCBlock<ffi.Void Function(NSInteger, NSURLCredential?)>,
)?
URLSession_didReceiveChallenge_completionHandler_,
void Function(NSURLSession)?
URLSessionDidFinishEventsForBackgroundURLSession_,
bool $keepIsolateAlive = true,
}) {
final builder = objc.ObjCProtocolBuilder(debugName: 'NSURLSessionDelegate');
NSURLSessionDelegate.URLSession_didBecomeInvalidWithError_.implement(
builder,
URLSession_didBecomeInvalidWithError_,
);
NSURLSessionDelegate
.URLSession_didReceiveChallenge_completionHandler_.implement(
builder,
URLSession_didReceiveChallenge_completionHandler_,
);
NSURLSessionDelegate
.URLSessionDidFinishEventsForBackgroundURLSession_.implement(
builder,
URLSessionDidFinishEventsForBackgroundURLSession_,
);
builder.addProtocol($protocol);
return NSURLSessionDelegate.castFrom(
builder.build(keepIsolateAlive: $keepIsolateAlive),
);
}