@@ -850,24 +850,26 @@ class URLSession extends _ObjectHolder<ncb.NSURLSession> {
850
850
}) {
851
851
final protoBuilder = objc.ObjCProtocolBuilder ();
852
852
853
- ncb.NSURLSessionDataDelegate .addToBuilderAsListener (
854
- protoBuilder,
855
- URLSession_task_didCompleteWithError_ : (nsSession, nsTask, nsError) {
856
- _decrementTaskCount ();
857
- if (onComplete != null ) {
858
- onComplete (
859
- URLSession ._(nsSession,
860
- isBackground: isBackground, hasDelegate: true ),
861
- URLSessionTask ._(nsTask),
862
- nsError);
863
- }
864
- },
865
- );
853
+ ncb.NSURLSessionDataDelegate .URLSession_task_didCompleteWithError_
854
+ .implementAsListener (protoBuilder, (nsSession, nsTask, nsError) {
855
+ _decrementTaskCount ();
856
+ if (onComplete != null ) {
857
+ onComplete (
858
+ URLSession ._(nsSession,
859
+ isBackground: isBackground, hasDelegate: true ),
860
+ URLSessionTask ._(nsTask),
861
+ nsError);
862
+ }
863
+ });
866
864
867
865
if (onRedirect != null ) {
868
- ncb.NSURLSessionDataDelegate .addToBuilderAsListener (protoBuilder,
866
+ ncb
867
+ .NSURLSessionDataDelegate
869
868
// ignore: lines_longer_than_80_chars
870
- URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_ :
869
+ .URLSession_task_willPerformHTTPRedirection_newRequest_completionHandler_
870
+ .implementAsListener (protoBuilder,
871
+ // ignore: lines_longer_than_80_chars
872
+
871
873
(nsSession, nsTask, nsResponse, nsRequest, nsRequestCompleter) {
872
874
final request = URLRequest ._(nsRequest);
873
875
URLRequest ? redirectRequest;
@@ -891,8 +893,9 @@ class URLSession extends _ObjectHolder<ncb.NSURLSession> {
891
893
}
892
894
893
895
if (onResponse != null ) {
894
- ncb.NSURLSessionDataDelegate .addToBuilderAsListener (protoBuilder,
895
- URLSession_dataTask_didReceiveResponse_completionHandler_ :
896
+ ncb.NSURLSessionDataDelegate
897
+ .URLSession_dataTask_didReceiveResponse_completionHandler_
898
+ .implementAsListener (protoBuilder,
896
899
(nsSession, nsDataTask, nsResponse, nsCompletionHandler) {
897
900
final exactResponse = URLResponse ._exactURLResponseType (nsResponse);
898
901
final disposition = onResponse (
@@ -905,8 +908,8 @@ class URLSession extends _ObjectHolder<ncb.NSURLSession> {
905
908
}
906
909
907
910
if (onData != null ) {
908
- ncb.NSURLSessionDataDelegate .addToBuilderAsListener (protoBuilder,
909
- URLSession_dataTask_didReceiveData_ : (nsSession, nsDataTask, nsData) {
911
+ ncb.NSURLSessionDataDelegate .URLSession_dataTask_didReceiveData_
912
+ . implementAsListener (protoBuilder, (nsSession, nsDataTask, nsData) {
910
913
onData (
911
914
URLSession ._(nsSession,
912
915
isBackground: isBackground, hasDelegate: true ),
@@ -942,9 +945,9 @@ class URLSession extends _ObjectHolder<ncb.NSURLSession> {
942
945
}
943
946
944
947
if (onWebSocketTaskOpened != null ) {
945
- ncb.NSURLSessionWebSocketDelegate . addToBuilderAsListener (protoBuilder,
946
- URLSession_webSocketTask_didOpenWithProtocol_ :
947
- (nsSession, nsTask, nsProtocol) {
948
+ ncb.NSURLSessionWebSocketDelegate
949
+ . URLSession_webSocketTask_didOpenWithProtocol_
950
+ . implementAsListener (protoBuilder, (nsSession, nsTask, nsProtocol) {
948
951
onWebSocketTaskOpened (
949
952
URLSession ._(nsSession,
950
953
isBackground: isBackground, hasDelegate: true ),
@@ -954,8 +957,9 @@ class URLSession extends _ObjectHolder<ncb.NSURLSession> {
954
957
}
955
958
956
959
if (onWebSocketTaskClosed != null ) {
957
- ncb.NSURLSessionWebSocketDelegate .addToBuilderAsListener (protoBuilder,
958
- URLSession_webSocketTask_didCloseWithCode_reason_ :
960
+ ncb.NSURLSessionWebSocketDelegate
961
+ .URLSession_webSocketTask_didCloseWithCode_reason_
962
+ .implementAsListener (protoBuilder,
959
963
(nsSession, nsTask, closeCode, reason) {
960
964
onWebSocketTaskClosed (
961
965
URLSession ._(nsSession,
0 commit comments