Skip to content

Commit

Permalink
Update cupertino_api.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
brianquinlan committed Mar 22, 2024
1 parent 8c86bc5 commit 3be91ed
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions pkgs/cupertino_http/lib/src/cupertino_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ class Error extends _ObjectHolder<ncb.NSError> implements Exception {
linkedLibs, linkedLibs.NSLocalizedDescriptionKey),
);
}
final e = ncb.NSError.alloc(linkedLibs).initWithDomain_code_userInfo_(
domain.toNSString(linkedLibs).pointer, code, d);
final e = ncb.NSError.alloc(linkedLibs)
.initWithDomain_code_userInfo_(domain.toNSString(linkedLibs), code, d);
return Error._(e);
}

Expand All @@ -201,8 +201,7 @@ class Error extends _ObjectHolder<ncb.NSError> implements Exception {
/// The error domain, for example `"NSPOSIXErrorDomain"`.
///
/// See [NSError.domain](https://developer.apple.com/documentation/foundation/nserror/1413924-domain)
String get domain =>
ncb.NSString.castFromPointer(linkedLibs, _nsObject.domain).toString();
String get domain => _nsObject.domain.toString();

/// A description of the error in the current locale e.g.
/// 'A server with the specified hostname could not be found.'
Expand Down Expand Up @@ -552,7 +551,7 @@ class MutableData extends Data {

/// A new empty [MutableData].
factory MutableData.empty() =>
MutableData._(ncb.NSMutableData.dataWithCapacity_(linkedLibs, 0));
MutableData._(ncb.NSMutableData.dataWithCapacity_(linkedLibs, 0)!);

/// Appends the given data.
///
Expand Down Expand Up @@ -918,8 +917,8 @@ class URLSessionWebSocketTask extends URLSessionTask {
completionPort.close();
});

helperLibs.CUPHTTPSendMessage(_urlSessionWebSocketTask.pointer,
message._nsObject.pointer, completionPort.sendPort.nativePort);
helperLibs.CUPHTTPSendMessage(_urlSessionWebSocketTask, message._nsObject,
completionPort.sendPort.nativePort);
await completer.future;
}

Expand Down Expand Up @@ -956,7 +955,7 @@ class URLSessionWebSocketTask extends URLSessionTask {
});

helperLibs.CUPHTTPReceiveMessage(
_urlSessionWebSocketTask.pointer, completionPort.sendPort.nativePort);
_urlSessionWebSocketTask, completionPort.sendPort.nativePort);
return completer.future;
}

Expand Down Expand Up @@ -1066,7 +1065,7 @@ class MutableURLRequest extends URLRequest {
/// See [NSMutableURLRequest.requestWithURL:](https://developer.apple.com/documentation/foundation/nsmutableurlrequest/1414617-allhttpheaderfields)
factory MutableURLRequest.fromUrl(Uri uri) {
final url = ncb.NSURL
.URLWithString_(linkedLibs, uri.toString().toNSString(linkedLibs));
.URLWithString_(linkedLibs, uri.toString().toNSString(linkedLibs))!;
return MutableURLRequest._(
ncb.NSMutableURLRequest.requestWithURL_(linkedLibs, url));
}
Expand Down Expand Up @@ -1176,7 +1175,7 @@ void _setupDelegation(
// with it.
}
} finally {
forwardedRedirect.finishWithRequest_(redirectRequest?._nsObject);
forwardedRedirect.finishWithRequest_(redirectRequest!._nsObject);
}
break;
case ncb.MessageType.ResponseMessage:
Expand Down

0 comments on commit 3be91ed

Please sign in to comment.