From: Shan Shaji <s.shaji@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH proxmox_dart_api_client 2/2] deps: add objective_c dependency to access NSError's code property
Date: Fri, 10 Apr 2026 17:09:35 +0200 [thread overview]
Message-ID: <20260410150935.25870-8-s.shaji@proxmox.com> (raw)
In-Reply-To: <20260410150935.25870-1-s.shaji@proxmox.com>
Starting from `v9.0.0` of the `objective_c` package, `NSError` is defined
as an extension type [0] instead of a wrapper class in Dart. As a result, the
`code` property is not accessible at compile time unless the extension
type is explicitly imported, even though the underlying object exposes
it at runtime.
To fix this, the `objective_c` dependency has been added and imported the
dependency were the code property is accessed.
- [0] https://github.com/dart-lang/native/pull/2723
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
lib/src/authenticate.dart | 15 ++++++---------
pubspec.lock | 2 +-
pubspec.yaml | 1 +
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/lib/src/authenticate.dart b/lib/src/authenticate.dart
index 4c9ae22..203c165 100644
--- a/lib/src/authenticate.dart
+++ b/lib/src/authenticate.dart
@@ -7,6 +7,7 @@ import 'package:http/http.dart' as http;
import 'package:proxmox_dart_api_client/proxmox_dart_api_client.dart';
import 'package:proxmox_dart_api_client/src/handle_ticket_response.dart';
import 'package:proxmox_dart_api_client/src/models/serializers.dart';
+import 'package:objective_c/objective_c.dart';
/// Returns an authenticated client to work with if successful.
///
@@ -38,10 +39,7 @@ Future<ProxmoxApiClient> authenticate(
print("retrying for backward compat!");
final errors = jsonDecode(response.body)['errors'] ?? {};
if (errors.containsKey('new-format')) {
- var body = {
- 'username': username,
- 'password': password,
- };
+ var body = {'username': username, 'password': password};
response = await httpClient
.post(credentials.ticketUrl, body: body)
.timeout(Duration(seconds: 25));
@@ -50,13 +48,12 @@ Future<ProxmoxApiClient> authenticate(
credentials = handleAccessTicketResponse(response, credentials);
- return ProxmoxApiClient(
- credentials,
- httpClient: httpClient,
- );
+ return ProxmoxApiClient(credentials, httpClient: httpClient);
} on TimeoutException catch (_) {
throw ProxmoxApiException(
- 'Authentication takes unusually long, check network connection', 408);
+ 'Authentication takes unusually long, check network connection',
+ 408,
+ );
} on NSErrorClientException catch (e) {
// Treat untrusted server certificate (-1202) as a handshake failure.
if (e.error.code == -1202) {
diff --git a/pubspec.lock b/pubspec.lock
index 66aa9b8..ffdf790 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -375,7 +375,7 @@ packages:
source: hosted
version: "2.0.2"
objective_c:
- dependency: transitive
+ dependency: "direct main"
description:
name: objective_c
sha256: "100a1c87616ab6ed41ec263b083c0ef3261ee6cd1dc3b0f35f8ddfa4f996fe52"
diff --git a/pubspec.yaml b/pubspec.yaml
index 9094c4d..a3426cc 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -12,6 +12,7 @@ dependencies:
retry: ^3.1.0
cronet_http: ^1.5.0
cupertino_http: ^2.3.0
+ objective_c: ^9.3.0
dev_dependencies:
lints: ^6.0.0
--
2.50.1
prev parent reply other threads:[~2026-04-10 15:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-10 15:09 [PATCH proxmox{_login_manager,_dart_api_client}/pve_flutter_frontend 0/7] upgrade dependencies based on flutter v3.41 and migrate deprecated members Shan Shaji
2026-04-10 15:09 ` [PATCH pve_flutter_frontend 1/4] chore: upgrade dependencies based on flutter v3.41 Shan Shaji
2026-04-10 15:09 ` [PATCH pve_flutter_frontend 2/4] fix: breaking changes due to the upgrade of font_awesome_flutter to v11 Shan Shaji
2026-04-10 15:09 ` [PATCH pve_flutter_frontend 3/4] fix: migrate to UIScene lifecycle for iOS 26+ compatibility Shan Shaji
2026-04-10 15:09 ` [PATCH pve_flutter_frontend 4/4] chore: use latest ndkVersion from flutter Shan Shaji
2026-04-10 15:09 ` [PATCH proxmox_login_manager 1/1] chore: upgrade dependencies Shan Shaji
2026-04-10 15:09 ` [PATCH proxmox_dart_api_client 1/2] " Shan Shaji
2026-04-10 15:09 ` Shan Shaji [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260410150935.25870-8-s.shaji@proxmox.com \
--to=s.shaji@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox