Skip to content

feat: Flutter SDK update for version 21.0.0#294

Merged
abnegate merged 4 commits intomainfrom
dev
Feb 2, 2026
Merged

feat: Flutter SDK update for version 21.0.0#294
abnegate merged 4 commits intomainfrom
dev

Conversation

@ChiragAgg5k
Copy link
Member

@ChiragAgg5k ChiragAgg5k commented Feb 2, 2026

This PR contains updates to the Flutter SDK for version 21.0.0.

@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

Warning

Rate limit exceeded

@github-actions[bot] has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 34 minutes and 40 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

This pull request introduces version 21.0.0 of the Appwrite Flutter SDK with significant API refinements. The changes include a new type-safe Channel routing API for building resource paths, expanded Query filtering capabilities with regex, exists, notExists, and elemMatch methods, and new enum types (BrowserPermission and Roles) to replace string-based parameters. Multiple service methods now accept strongly-typed enum parameters instead of strings (permissions, roles). The File model gains encryption and compression fields. Documentation examples are updated to use namespace-qualified enum references. The Realtime.subscribe method now accepts List to support both string channels and Channel builder objects. Version references and SDK headers are bumped to 21.0.0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change as a version update to 21.0.0, which is the primary objective reflected across all files (CHANGELOG, README, pubspec.yaml, and SDK version headers).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
docs/examples/storage/get-file-preview.md (1)

1-1: ⚠️ Potential issue | 🔴 Critical

Add missing enums import.

The code uses enums.ImageGravity and enums.ImageFormat on lines 15, 23, 37, and 45, but the required import is missing. The Appwrite Flutter SDK does not export these enums from package:appwrite/appwrite.dart—they must be imported from package:appwrite/enums.dart separately.

Add the alias import:

Fix
 import 'package:appwrite/appwrite.dart';
+import 'package:appwrite/enums.dart' as enums;
docs/examples/account/create-o-auth-2-session.md (1)

1-10: ⚠️ Potential issue | 🟡 Minor

Add the missing enums import.

The snippet references enums.OAuthProvider but only imports appwrite.dart, which does not re-export the enums alias. This will cause a compilation error. Add the explicit import:

 import 'package:appwrite/appwrite.dart';
+import 'package:appwrite/enums.dart' as enums;

Note: This same issue affects other documentation examples (teams, storage, functions, avatars).

lib/src/models/file.dart (1)

60-75: ⚠️ Potential issue | 🟠 Major

Handle null/missing values for encryption and compression fields in fromMap.

The current implementation assumes both fields are always present in the API response. Line 73 assigns map['encryption'] directly without null safety, and line 74 calls .toString() on a potentially null value. If the server omits these fields or returns null, fromMap will either fail at assignment (for encryption) or at runtime (for compression). This is especially risky given that encryption must be a bool and compression documentation indicates valid values are "none", "gzip", or "zstd".

Apply safe defaults aligned with field semantics:

🛠️ Proposed fix
-      encryption: map['encryption'],
-      compression: map['compression'].toString(),
+      encryption: map['encryption'] as bool? ?? false,
+      compression: map['compression']?.toString() ?? 'none',
🤖 Fix all issues with AI agents
In `@docs/examples/avatars/get-screenshot.md`:
- Around line 19-33: The example uses the enums alias (e.g., enums.Theme,
enums.Timezone, enums.BrowserPermission, enums.ImageFormat) but never imports
it; add an import for the enums alias from the SDK/module used in this project
(so the example compiles), then reference enums throughout the snippet; update
the top of the snippet to import the enums symbol (so get-screenshot.md examples
19-33 and similarly 50-64 compile).

In `@lib/src/realtime_mixin.dart`:
- Around line 169-188: The code currently accepts any Object in
subscribeTo(List<Object> channels) and coerces via _channelToString, which can
yield invalid names; fix by validating channel types before adding them: in
subscribeTo iterate channels and for each ensure it is either a String or a
Channel instance (the type you use in the codebase), otherwise throw an
ArgumentError naming the offending value; implement this validation either at
the start of subscribeTo or by updating _channelToString to perform the type
check and throw ArgumentError for unsupported types; continue to use the
validated channelStrings with _channels.addAll, RealtimeSubscription(...),
controller.close(), and _cleanup as before.

Comment on lines +19 to +33
theme: enums.Theme.dark, // optional
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional
fullpage: true, // optional
locale: 'en-US', // optional
timezone: Timezone.africaAbidjan, // optional
timezone: enums.Timezone.americaNewYork, // optional
latitude: 37.7749, // optional
longitude: -122.4194, // optional
accuracy: 100, // optional
touch: true, // optional
permissions: ["geolocation","notifications"], // optional
permissions: [enums.BrowserPermission.geolocation, enums.BrowserPermission.notifications], // optional
sleep: 3, // optional
width: 800, // optional
height: 600, // optional
quality: 85, // optional
output: ImageFormat.jpg, // optional
output: enums.ImageFormat.jpeg, // optional
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add the missing enums import for the updated snippet.

The example now uses enums.* but doesn’t import the alias, so it won’t compile as shown.

💡 Suggested fix
-import 'package:appwrite/appwrite.dart';
+import 'package:appwrite/appwrite.dart';
+import 'package:appwrite/enums.dart' as enums;

Also applies to: 50-64

🤖 Prompt for AI Agents
In `@docs/examples/avatars/get-screenshot.md` around lines 19 - 33, The example
uses the enums alias (e.g., enums.Theme, enums.Timezone,
enums.BrowserPermission, enums.ImageFormat) but never imports it; add an import
for the enums alias from the SDK/module used in this project (so the example
compiles), then reference enums throughout the snippet; update the top of the
snippet to import the enums symbol (so get-screenshot.md examples 19-33 and
similarly 50-64 compile).

Comment on lines +169 to +188
/// Convert channel value to string
/// Handles String and Channel instances (which have toString())
String _channelToString(Object channel) {
return channel is String ? channel : channel.toString();
}

RealtimeSubscription subscribeTo(List<Object> channels) {
StreamController<RealtimeMessage> controller = StreamController.broadcast();
_channels.addAll(channels);
final channelStrings =
channels.map((ch) => _channelToString(ch)).toList().cast<String>();
_channels.addAll(channelStrings);
Future.delayed(Duration.zero, () => _createSocket());
int id = DateTime.now().microsecondsSinceEpoch;
RealtimeSubscription subscription = RealtimeSubscription(
controller: controller,
channels: channels,
channels: channelStrings,
close: () async {
_subscriptions.remove(id);
controller.close();
_cleanup(channels);
_cleanup(channelStrings);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Guard against unsupported channel types.

List<Object> currently accepts anything and coerces via toString(), which can silently generate invalid channel names (e.g., “Instance of …”). Consider enforcing String or Channel and throwing ArgumentError otherwise.

🧩 Suggested fix
+import '../channel.dart';
...
   /// Convert channel value to string
   /// Handles String and Channel instances (which have toString())
   String _channelToString(Object channel) {
-    return channel is String ? channel : channel.toString();
+    if (channel is String) return channel;
+    if (channel is Channel) return channel.toString();
+    throw ArgumentError.value(
+        channel, 'channel', 'Expected String or Channel');
   }
🤖 Prompt for AI Agents
In `@lib/src/realtime_mixin.dart` around lines 169 - 188, The code currently
accepts any Object in subscribeTo(List<Object> channels) and coerces via
_channelToString, which can yield invalid names; fix by validating channel types
before adding them: in subscribeTo iterate channels and for each ensure it is
either a String or a Channel instance (the type you use in the codebase),
otherwise throw an ArgumentError naming the offending value; implement this
validation either at the start of subscribeTo or by updating _channelToString to
perform the type check and throw ArgumentError for unsupported types; continue
to use the validated channelStrings with _channels.addAll,
RealtimeSubscription(...), controller.close(), and _cleanup as before.

@abnegate abnegate merged commit 302dae1 into main Feb 2, 2026
1 check passed
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.

2 participants