-
Notifications
You must be signed in to change notification settings - Fork 149
feat: Flutter SDK update for version 20.3.3 #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis pull request releases version 20.3.3 of the SDK with several updates. The changes include bumping the version number across configuration and client files, updating copyright year in the LICENSE, and modifying API signatures to make certain parameters optional (data in Databases methods, duration in Account.createJWT). The Output enum is removed and replaced with ImageFormat for avatars. Documentation examples are updated to reflect new parameter handling, and a fix is implemented to properly handle boolean values in GET request parameters. The OAuthProvider enum gains a new mockUnverified value. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this 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
🤖 Fix all issues with AI agents
In @lib/services/account.dart:
- Around line 120-125: Update the createJWT method docstring to include the new
optional parameter `duration`: state that `duration` is an optional integer
(non-negative, can be 0) representing the token lifetime in seconds (or the same
unit used by the API), note any constraints such as non-negative values and
typical limits if known, and give a short example/mention that passing 0 is
supported per the examples; reference the createJWT function name so the
docstring change is applied to that method.
In @lib/services/storage.dart:
- Around line 113-116: The apiParams map in the uploadFile (or wherever this
snippet is) unconditionally includes 'permissions' which is nullable, causing a
null to be sent to the API; change the map construction for apiParams to include
'permissions' only when permissions != null (same conditional inclusion pattern
as used in createFile) so that 'permissions' is omitted when null rather than
set to null.
🧹 Nitpick comments (3)
lib/src/client_mixin.dart (1)
47-54: LGTM! The boolean handling fix is correct.The fix properly converts boolean values to strings for GET query parameters, which is necessary since URL query parameters are string-based.
Optional: The
int,double, andboolcases all call.toString(). You could consolidate them for brevity:♻️ Optional consolidation
- if (value is int || value is double) { - filteredParams[key] = value.toString(); - } else if (value is bool) { + if (value is int || value is double || value is bool) { filteredParams[key] = value.toString(); - } else if (value is List) { + } else if (value is List) {README.md (1)
10-10: Consider specifying the server version explicitly.Using "latest" for server compatibility is ambiguous and may cause confusion for users trying to match SDK and server versions. Consider documenting the actual compatible server version (e.g.,
1.8.xas shown in the badge on line 5).docs/examples/account/create-jwt.md (1)
9-11: Consider using a more meaningful example value forduration.Using
duration: 0in the example may confuse users about the expected behavior. If0means "use server default" that's fine, but if it means "immediate expiry" or is invalid, a more practical example likeduration: 900(15 minutes) would better demonstrate the parameter's purpose.💡 Suggested improvement
Jwt result = await account.createJWT( - duration: 0, // optional + duration: 900, // optional - duration in seconds );
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
CHANGELOG.mdLICENSEREADME.mddocs/examples/account/create-jwt.mddocs/examples/avatars/get-screenshot.mddocs/examples/databases/update-document.mddocs/examples/databases/upsert-document.mddocs/examples/tablesdb/update-row.mddocs/examples/tablesdb/upsert-row.mdlib/enums.dartlib/services/account.dartlib/services/avatars.dartlib/services/databases.dartlib/services/storage.dartlib/src/client_browser.dartlib/src/client_io.dartlib/src/client_mixin.dartlib/src/enums/o_auth_provider.dartlib/src/enums/output.dartpubspec.yamltest/services/databases_test.dart
💤 Files with no reviewable changes (2)
- lib/src/enums/output.dart
- test/services/databases_test.dart
🧰 Additional context used
🪛 LanguageTool
README.md
[style] ~12-~12: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help ...
(EN_WEAK_ADJECTIVE)
[grammar] ~12-~12: Use a hyphen to join words.
Context: ...e development tasks behind a very simple to use REST API. Appwrite aims to help y...
(QB_NEW_EN_HYPHEN)
[grammar] ~12-~12: Use a hyphen to join words.
Context: ...evelopment tasks behind a very simple to use REST API. Appwrite aims to help you ...
(QB_NEW_EN_HYPHEN)
🔇 Additional comments (15)
lib/src/client_io.dart (1)
61-61: LGTM!SDK version header correctly updated to 20.3.3, consistent with the pubspec.yaml version.
lib/src/client_browser.dart (1)
43-43: LGTM!SDK version header correctly updated to 20.3.3, consistent with client_io.dart and pubspec.yaml.
pubspec.yaml (1)
2-3: LGTM!Version bump to 20.3.3 is consistent with the client headers, and the grammar correction in the description improves subject-verb agreement.
LICENSE (1)
1-1: LGTM!Copyright year appropriately updated to 2026.
CHANGELOG.md (1)
3-5: LGTM!Changelog entry appropriately documents the boolean parameter fix. The fix is confirmed implemented in client_mixin.dart where boolean values are properly converted to strings (
.toString()) when building GET request query parameters.lib/enums.dart (1)
12-12: LGTM!The addition of
image_format.dartpart directive is consistent with the enum migration fromOutputtoImageFormatacross the SDK.docs/examples/tablesdb/upsert-row.md (1)
15-21: LGTM!The example now demonstrates realistic usage with populated user data fields, which is more helpful for developers than an empty object. The
// optionalcomment correctly reflects the API change makingdataoptional.lib/services/avatars.dart (1)
222-222: LGTM!The parameter type migration from
enums.Output?toenums.ImageFormat?is consistent with the enum refactoring in this SDK version. The usage pattern remains unchanged.docs/examples/avatars/get-screenshot.md (1)
33-33: LGTM!The documentation examples correctly reflect the enum rename from
OutputtoImageFormat, consistent with the library changes inlib/services/avatars.dart. Both code examples are updated consistently.Also applies to: 64-64
README.md (1)
22-22: LGTM!The dependency version correctly reflects the SDK version 20.3.3 being released.
lib/src/enums/o_auth_provider.dart (1)
43-44: ThemockUnverifiedenum value is not an official Appwrite OAuth provider and should not be included in this enum.The enum pattern and serialization are correctly implemented, but Appwrite does not provide official built-in mock OAuth providers for testing. The documented OAuth providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, yahoo, yammer, yandex, zoho, and zoom. Neither
mocknormockUnverifiedare supported by the Appwrite server.If mock OAuth testing is needed, use external mocking tools (Beeceptor, Mockoon) instead of adding unsupported provider values to the enum. Remove both
mockandmockUnverifiedfrom this enum.Likely an incorrect or invalid review comment.
lib/services/databases.dart (1)
217-234: LGTM! Optional data parameter properly implemented.The change to make
dataoptional inupsertDocumentis correctly implemented:
- The parameter is properly nullable (
Map? data)- The conditional inclusion (
if (data != null)) prevents sendingnullvalues in the request payloadThis allows upsert operations that only modify permissions without requiring document data.
docs/examples/tablesdb/update-row.md (1)
15-21: Documentation improvement looks good.The example now demonstrates realistic usage with meaningful field values instead of an empty object. The
// optionalcomment correctly reflects that thedataparameter is no longer required.docs/examples/databases/update-document.md (1)
15-21: Documentation correctly updated with example payload.The example is consistent with other documentation updates in this PR and demonstrates realistic usage.
docs/examples/databases/upsert-document.md (1)
15-21: Documentation correctly reflects the optional data parameter.The example payload aligns with the API change in
lib/services/databases.dartwhereupsertDocument'sdataparameter is now optional.
| Future<models.Jwt> createJWT({int? duration}) async { | ||
| const String apiPath = '/account/jwts'; | ||
|
|
||
| final Map<String, dynamic> apiParams = {}; | ||
| final Map<String, dynamic> apiParams = { | ||
| if (duration != null) 'duration': duration, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# First, check the createJWT method implementation
cat -n lib/services/account.dart | sed -n '110,135p'Repository: appwrite/sdk-for-flutter
Length of output: 1130
🏁 Script executed:
# Check docstring pattern for other methods in this file
rg -A 10 "Future<" lib/services/account.dart | head -50Repository: appwrite/sdk-for-flutter
Length of output: 1492
🏁 Script executed:
# Search for duration parameter documentation
rg -n "duration" lib/services/account.dartRepository: appwrite/sdk-for-flutter
Length of output: 181
🏁 Script executed:
# Search for any documentation about duration parameter
rg -n "duration" --type md --type txt docs/ 2>/dev/null | head -20Repository: appwrite/sdk-for-flutter
Length of output: 135
🏁 Script executed:
# Check if there's an API specification or reference
find . -name "*.md" -o -name "*.txt" | xargs rg -l "createJWT\|duration" 2>/dev/null | head -10Repository: appwrite/sdk-for-flutter
Length of output: 50
🏁 Script executed:
# Check for other similar parameters and how they're documented in docstrings
rg -B 5 "Future<models\." lib/services/account.dart | grep -A 5 "///"Repository: appwrite/sdk-for-flutter
Length of output: 15603
Add parameter documentation for duration to the docstring.
The implementation is correct and follows the established pattern for optional parameters. However, the docstring (lines 115-119) completely omits the new duration parameter. Update the docstring to document what this parameter does and its valid range or constraints. The example in docs/examples/account/create-jwt.md shows it accepts values like 0, which could serve as a reference.
🤖 Prompt for AI Agents
In @lib/services/account.dart around lines 120 - 125, Update the createJWT
method docstring to include the new optional parameter `duration`: state that
`duration` is an optional integer (non-negative, can be 0) representing the
token lifetime in seconds (or the same unit used by the API), note any
constraints such as non-negative values and typical limits if known, and give a
short example/mention that passing 0 is supported per the examples; reference
the createJWT function name so the docstring change is applied to that method.
| final Map<String, dynamic> apiParams = { | ||
| 'name': name, | ||
| if (name != null) 'name': name, | ||
| 'permissions': permissions, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat -n lib/services/storage.dart | head -130 | tail -30Repository: appwrite/sdk-for-flutter
Length of output: 1287
🏁 Script executed:
# Check the function signature to see parameter types
rg -n "permissions" lib/services/storage.dart -B5 -A2Repository: appwrite/sdk-for-flutter
Length of output: 1694
🏁 Script executed:
# Check how apiParams is used after being defined
rg -n "apiParams" lib/services/storage.dart -A10Repository: appwrite/sdk-for-flutter
Length of output: 3629
Inconsistent null handling for permissions parameter.
The name parameter is conditionally included only when non-null (line 114), but permissions on line 115 is unconditionally included. Since permissions is also nullable (List<String>?), this will send a null value to the API when not provided, whereas the createFile method in the same file correctly uses conditional inclusion for permissions (line 62).
Apply the same conditional pattern:
🔧 Suggested fix
final Map<String, dynamic> apiParams = {
if (name != null) 'name': name,
- 'permissions': permissions,
+ if (permissions != null) 'permissions': permissions,
};📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| final Map<String, dynamic> apiParams = { | |
| 'name': name, | |
| if (name != null) 'name': name, | |
| 'permissions': permissions, | |
| }; | |
| final Map<String, dynamic> apiParams = { | |
| if (name != null) 'name': name, | |
| if (permissions != null) 'permissions': permissions, | |
| }; |
🤖 Prompt for AI Agents
In @lib/services/storage.dart around lines 113 - 116, The apiParams map in the
uploadFile (or wherever this snippet is) unconditionally includes 'permissions'
which is nullable, causing a null to be sent to the API; change the map
construction for apiParams to include 'permissions' only when permissions !=
null (same conditional inclusion pattern as used in createFile) so that
'permissions' is omitted when null rather than set to null.
This PR contains updates to the Flutter SDK for version 20.3.3.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.