Skip to content

feat: SDK update for version 25.0.0#312

Closed
ChiragAgg5k wants to merge 2 commits into
mainfrom
dev
Closed

feat: SDK update for version 25.0.0#312
ChiragAgg5k wants to merge 2 commits into
mainfrom
dev

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented May 19, 2026

Copy link
Copy Markdown
Member

This PR contains updates to the SDK for version 25.0.0.

What's Changed

  • Added: ClientAuth interface returned by static factory constructors
  • Added: Static factory constructors Client.from, Client.fromSession, Client.fromDevKey, and Client.fromImpersonation
  • Added: Endpoint scheme validation in factory setup (rejects non-http(s)/ws(s) URLs)
  • Added: Realtime and generated services accept factory-created ClientAuth clients
  • Deprecated: Client() constructor and setter pattern remain for backwards compatibility but are marked deprecated where the analyzer supports it
  • Updated: Consolidated realtime IO and browser implementations into the shared client

@ChiragAgg5k ChiragAgg5k changed the title feat: Flutter SDK update for version 25.0.0 feat: SDK update for version 25.0.0 May 19, 2026
@greptile-apps

greptile-apps Bot commented May 19, 2026

Copy link
Copy Markdown

Greptile Summary

This PR introduces SDK version 25.0.0, replacing the mutable Client setter pattern with a new immutable ClientAuth interface and four static factory constructors (Client.from, Client.fromSession, Client.fromDevKey, Client.fromImpersonation). The legacy Client() constructor and its setter chain remain for backwards compatibility, and the realtime WebSocket logic is consolidated into the platform clients.

  • New ClientAuth interface with four factory constructors performs endpoint scheme validation and wires all services and Realtime to the new immutable client type.
  • Service.client public field removed — each service now owns a private _client: ClientAuth; this is an undocumented breaking change for any downstream code that accessed service.client directly.
  • Client() factory constructor missing @Deprecated annotation — the CHANGELOG claims it is deprecated, but the code carries no annotation, so users see no analyzer warning when using the old pattern.

Confidence Score: 4/5

The core factory constructor logic, endpoint validation, and service migrations are correct and internally consistent. Two gaps — a missing deprecation annotation and an undocumented breaking API removal — won't crash production at runtime but will surprise users upgrading from 24.x.

The new ClientAuth interface and factory constructors work correctly. The primary gaps are documentation/annotation mismatches: Service.client disappears silently (breaking any code that accessed it) and Client() carries no @Deprecated annotation despite being labelled deprecated in the changelog. Neither causes a runtime failure in the new code paths, but they add friction for the upgrade experience.

lib/src/service.dart (undocumented breaking field removal) and lib/src/client.dart (missing @Deprecated on the Client() factory constructor).

Important Files Changed

Filename Overview
lib/src/client.dart New ClientAuth interface and static factory constructors (from, fromSession, fromDevKey, fromImpersonation) added; endpoint/realtime URL scheme validation implemented. Client() constructor is missing its @Deprecated annotation despite the changelog claiming it is deprecated.
lib/src/service.dart Removed the public final Client client field and models import; constructor now accepts and discards ClientAuth _. This is a silent breaking change for callers that accessed service.client directly.
CHANGELOG.md Lists six changes for 25.0.0 but omits the breaking removal of Service.client public field, which is a significant omission for downstream users.
lib/src/realtime_mixin.dart Changed late Client client to late ClientAuth client; all accessed members (endPointRealtime, config, realtimeWebSocket, realtimeFallbackCookie) are present on ClientAuth. No functional regressions.
lib/src/client_browser.dart Added realtimeWebSocket and realtimeFallbackCookie methods consolidated from the old realtime_browser.dart; deprecated setter methods annotated correctly.
lib/src/client_io.dart Added realtimeWebSocket and realtimeFallbackCookie methods (IO returns null for fallback cookie); realtime self-signed cert handling moved in. Deprecated setters annotated consistently.
lib/src/realtime_browser.dart Simplified to delegate WebSocket creation and fallback cookie to the client itself; constructor pattern is clean.
lib/src/realtime_io.dart Simplified analogously to the browser version; delegates WebSocket to client.realtimeWebSocket.
lib/src/realtime.dart Factory now accepts ClientAuth instead of Client, correctly broadening the acceptable input type.
lib/src/client_base.dart Implements Client (which extends ClientAuth); deprecated annotations added consistently to all setter overrides.
lib/services/account.dart Migrated to store a private _client: ClientAuth field; all call sites updated consistently.
lib/services/presences.dart New service added with the same private _client: ClientAuth pattern as other services; consistent implementation.
lib/services/tables_db.dart Migrated to private _client: ClientAuth field pattern; call sites updated consistently.
lib/src/realtime_stub.dart Updated createRealtime signature to accept ClientAuth; stub body unchanged.
pubspec.yaml Version bumped to 25.0.0; dependency ranges unchanged.

Reviews (1): Last reviewed commit: "Commit from GitHub Actions (Format and p..." | Re-trigger Greptile

Comment thread lib/src/client.dart
Comment on lines +61 to +65
factory Client({
String endPoint = 'https://cloud.appwrite.io/v1',
bool selfSigned = false,
}) =>
createClient(endPoint: endPoint, selfSigned: selfSigned);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Client() constructor not annotated as deprecated

The CHANGELOG entry for 25.0.0 states: "Deprecated: Client() constructor and setter pattern remain for backwards compatibility but are marked deprecated where the analyzer supports it." Every setter method on Client received a @Deprecated annotation, but the factory Client({...}) constructor itself did not. In Dart, @Deprecated is valid on factory constructors and will generate analyzer warnings for call sites. Without it, users who continue using Client() see no IDE warnings or dart analyze hints pointing them toward the new factory constructors.

Comment thread CHANGELOG.md
Comment on lines +3 to 13
## 25.0.0

* Added: `ClientAuth` interface returned by static factory constructors
* Added: Static factory constructors `Client.from`, `Client.fromSession`, `Client.fromDevKey`, and `Client.fromImpersonation`
* Added: Endpoint scheme validation in factory setup (rejects non-`http(s)`/`ws(s)` URLs)
* Added: `Realtime` and generated services accept factory-created `ClientAuth` clients
* Deprecated: `Client()` constructor and setter pattern remain for backwards compatibility but are marked deprecated where the analyzer supports it
* Updated: Consolidated realtime IO and browser implementations into the shared client

## 24.1.1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Breaking change not documented: Service.client field removed

The old Service class exposed a public final Client client field that subclasses and any downstream code could access directly (e.g., myService.client). This PR removes that field entirely — Service is now const Service(ClientAuth _) with no stored reference. Each service subclass now holds its own private _client field. Any app-layer code or third-party integration that relied on aService.client will fail to compile at 25.0.0. The CHANGELOG lists six bullet points for this release but does not mention this breaking removal, which is a significant omission for a public-API change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant