-
-
Notifications
You must be signed in to change notification settings - Fork 213
Add Aggregate Query Support to Parse Flutter SDK #1041
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
base: master
Are you sure you want to change the base?
Changes from 4 commits
8ad7e19
e65a3f5
c093ff1
29d83f5
3a4feb6
bd2b057
7dabdcb
953b54a
a255b0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| part of '../../parse_server_sdk.dart'; | ||
|
|
||
| class ParseAggregate { | ||
| final String className; | ||
| dynamic pipeline; | ||
| final bool? debug; | ||
| final ParseClient? client; | ||
| final bool? autoSendSessionId; | ||
| final String? parseClassName; | ||
|
|
||
| ParseAggregate(this.className,{required this.pipeline,this.debug, this.client, this.autoSendSessionId, this.parseClassName}); | ||
|
|
||
| Future<ParseResponse> execute() async { | ||
| Map<String,String> _pipeline={}; | ||
| if(!((pipeline is Map) || (pipeline is List<Map>))){ | ||
| throw ArgumentError('pipeline Object should be a Map or a List of Maps. Example1: {"\$group": {"_id": "\$userId", "totalScore": {"\$sum": "\$score"}}} '); | ||
| } | ||
| if(pipeline.isEmpty){ | ||
| throw ArgumentError('pipeline must not be empty. Please add pipeline operations to aggregate data. Example: {"\$group": {"_id": "\$userId", "totalScore": {"\$sum": "\$score"}}} '); | ||
| } | ||
| else{ | ||
| _pipeline.addAll({'pipeline':jsonEncode(pipeline is List? pipeline : [pipeline])}); | ||
| } | ||
| final debugBool = isDebugEnabled(objectLevelDebug: debug); | ||
| final result = await ParseObject(className)._client.get( | ||
| Uri.parse('${ParseCoreData().serverUrl}$keyEndPointAggregate$className').replace(queryParameters: _pipeline).toString(), | ||
| ); | ||
| print('result >>> ${result.data}'); | ||
| return handleResponse<ParseObject>( | ||
| ParseObject(className), | ||
| result, | ||
| ParseApiRQ.get, | ||
| debugBool, | ||
| parseClassName ?? 'ParseBase', | ||
| ); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| class UrlReplace{ | ||
| String? scheme; | ||
| String? userInfo; | ||
| String? host; | ||
| int? port; | ||
| String? path; | ||
| Iterable<String>? pathSegments; | ||
| String? query; | ||
| Map<String, dynamic>? queryParameters; | ||
| String? fragment; | ||
|
|
||
| UrlReplace({ | ||
| this.scheme, | ||
| this.userInfo, | ||
| this.host, | ||
| this.port, | ||
| this.path, | ||
| this.pathSegments, | ||
| this.query, | ||
| this.queryParameters, | ||
| this.fragment, | ||
| }); | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,7 +24,7 @@ dependencies: | |||||||||||
| # Networking | ||||||||||||
| dio: ^5.7.0 | ||||||||||||
| http: ^1.2.0 | ||||||||||||
| web_socket_channel: ^2.4.3 | ||||||||||||
| web_socket_channel: ^3.0.3 | ||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify compatibility with web_socket_channel major version upgrade The 🌐 Web query: 💡 Result: Breaking Changes in
|
||||||||||||
| Breaking Change | Details |
|---|---|
| Constructor removal | No direct WebSocketChannel() instantiation; use factory constructors instead |
| Abstract interface | WebSocketChannel is now abstract; use specific implementations |
Exception change in ready |
Throws WebSocketChannelException (previously WebSocketException) |
| Default web adapter | Uses package:web_socket adapter for web via WebSocketChannel.connect |
Developers upgrading to v3.0.0 should adjust their code to accommodate these changes[1][6].
Citations:
- 1: https://github.com/dart-lang/web_socket_channel/blob/master/CHANGELOG.md
- 2: https://github.com/dart-lang/web_socket_channel/releases
- 3: https://chromium.googlesource.com/external/github.com/dart-lang/shelf_web_socket/+/24fb8a04befa75a94ac63a27047b231d1a22aab4/CHANGELOG.md
- 4: https://pub.dev/packages/web_socket_channel
- 5: https://dartfrog.vgv.dev/docs/tutorials/web_socket_counter
- 6: https://pub.dev/packages/web_socket_channel/changelog
- 7: https://pub.dev/packages/centrifuge/changelog
- 8: https://pub.dev/packages/deepgram_speech_to_text/changelog
- 9: https://dartfrog.vgv.dev/docs/advanced/web_socket
- 10: https://websockets.readthedocs.io/en/stable/project/changelog.html
Validate Breaking Changes for web_socket_channel v3.0.0
We’ve bumped web_socket_channel from ^2.4.3 to ^3.0.3, which includes these breaking changes:
- Removal of the direct
WebSocketChannel()constructor – you must now useWebSocketChannel.connect(...). WebSocketChannelis now an abstract interface.IOWebSocketChannel.readythrowsWebSocketChannelException(instead ofWebSocketException).- Default web implementation now uses the
package:web_socketadapter.
Please audit the Dart code for:
- Any instantiation of
WebSocketChannel()(replace withconnect). - Direct uses of
IOWebSocketChanneland calls to itsreadyproperty (update exception handling). - Web‐platform socket code relying on the old adapter.
Make the necessary updates or confirm that your code paths already comply with the new API.
🤖 Prompt for AI Agents (early access)
In packages/dart/pubspec.yaml at line 27, the web_socket_channel dependency has been upgraded from ^2.4.3 to ^3.0.3, which introduces breaking changes. Audit all Dart code that uses web_socket_channel for direct instantiation of WebSocketChannel() and replace these with WebSocketChannel.connect(...) factory methods. Also, update any exception handling around IOWebSocketChannel.ready to catch WebSocketChannelException instead of WebSocketException. Verify web platform socket code to ensure compatibility with the new package:web_socket adapter. Make these code adjustments to align with the new major version API.
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.
Are these dependency upgrades necessary for this feature?
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.
No but your package dependancies are old and I upgrade it to be compatible with new versions
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.
Coyld you please remove any changes that are not necessary for this PR? You could open another, separate PR for the dependency upgrades, that should only contain the upgrades.
| Original file line number | Diff line number | Diff line change | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,7 +25,7 @@ dependencies: | ||||||||||||||||
| flutter: | |||||||||||||||||
| sdk: flutter | |||||||||||||||||
|
|
|||||||||||||||||
| parse_server_sdk: ^6.4.0 | |||||||||||||||||
| parse_server_sdk: ^8.0.0 | |||||||||||||||||
| # Uncomment for local testing | |||||||||||||||||
| #parse_server_sdk: | |||||||||||||||||
| # path: ../dart | |||||||||||||||||
|
|
@@ -40,14 +40,14 @@ dependencies: | ||||||||||||||||
|
|
|||||||||||||||||
| # Utils | |||||||||||||||||
| path_provider: ^2.1.4 | |||||||||||||||||
| package_info_plus: ^5.0.1 | |||||||||||||||||
| package_info_plus: ^8.3.0 | |||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainCheck for potential issues with package_info_plus upgrade The 🌐 Web query: 💡 Result: Breaking Changes Between
|
|||||||||||||||||
| Version | Breaking Change Description |
|---|---|
| 5.0.1 | versionJsonUrl can omit .json extension on web[3] |
| 7.0.0 | buildSignature uses SHA-256 on Android[1] |
If you rely on either buildSignature for Android or serve web builds with a specific versionJsonUrl file extension, carefully review your implementation when upgrading between these versions.
Further Recommendations:
- Review the full changelog for
package_info_plusfor all detailed updates between your installed version and the latest[1]. - Test each platform you support (Android, iOS, Web) after upgrading to catch any behavioral nuances, especially around version/build info retrieval and signature computation.
Citations:
- 1: https://pub.dev/packages/package_info_plus/changelog
- 2: https://github.com/fluttercommunity/plus_plugins/blob/main/packages/share_plus/share_plus/CHANGELOG.md
- 3: https://pub.dev/packages/package_info_plus/versions/5.0.1/changelog
- 4: package_info_plus 5.0.1 not supporting. fluttercommunity/wakelock_plus#16
- 5: https://docs.flutter.dev/release/breaking-changes
- 6: https://www.dhiwise.com/post/complete-guide-to-using-flutter-package-info-plus-for-app
- 7: https://pub.dev/packages/sentry_flutter/versions/8.14.1/changelog
- 8: https://pub.dev/packages/package_info_plus
- 9: [Question]: Error build android since package_info_plus 3.0.1 fluttercommunity/plus_plugins#1290
- 10: https://community.flutterflow.io/ask-the-community/post/execution-failed-for-task-package-info-plus-compilereleasejavawithjavac-lx9rOtUbT6bNb4f
Review Breaking Changes in package_info_plus Upgrade
The jump from ^5.0.1 to ^8.3.0 introduces a couple of breaking changes you should verify:
- Android (v7.0.0):
buildSignaturenow uses SHA-256 instead of the previous hashing method. If your app logic depends on this value, update or re-test accordingly. - Web (v5.0.1):
versionJsonUrlno longer requires a.jsonextension. Ensure your server or deployment doesn’t rely on a fixed.jsonsuffix.
All other core PackageInfo APIs (version, build number, etc.) remain unchanged. Please review your implementation, adjust any dependent logic, and test each platform (Android, iOS, Web) after upgrading.
🤖 Prompt for AI Agents (early access)
In packages/flutter/pubspec.yaml at line 43, the package_info_plus dependency was upgraded from ^5.0.1 to ^8.3.0, which includes breaking changes. Review your app code for any usage of buildSignature on Android and update or retest it due to the switch to SHA-256 hashing in v7.0.0. Also, verify your web deployment does not rely on a .json extension in versionJsonUrl, adjusting server or deployment settings if necessary. Finally, test all platforms thoroughly to ensure compatibility with the new package version.
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.
💡 Verification agent
🧩 Analysis chain
Updated linting rules
The flutter_lints dev dependency has been updated from ^4.0.0 to ^5.0.0. This may introduce new linting rules or deprecate existing ones.
🌐 Web query:
What are the changes in flutter_lints between version 4.0.0 and 5.0.0?
💡 Result:
Changes in flutter_lints Between Versions 4.0.0 and 5.0.0
Summary Table
| Category | 4.0.0 | 5.0.0 |
|---|---|---|
package:lints dependency |
4.0.0 | 5.0.0 |
| Minimum SDK | Flutter 3.13 / Dart 3.1 | Flutter 3.24 / Dart 3.5 |
| Lints Added | library_annotationsno_wildcard_variable_uses |
invalid_runtime_check_with_js_interop_typesunnecessary_library_name |
| Lints Removed | package_prefixed_library_nameslibrary_names |
avoid_null_checks_in_equality_operatorsprefer_const_constructorsprefer_const_declarationsprefer_const_literals_to_create_immutables |
Detailed Changes
Dependency and SDK Updates
- The internal dependency was updated:
package:lintsupgraded from version 4.0.0 to 5.0.0. - Minimum required Flutter and Dart SDK versions increased to Flutter 3.24 and Dart 3.5[1][2][4].
New Lints Added
invalid_runtime_check_with_js_interop_types: Prevents incorrect runtime checks with interop types, improving JavaScript interoperability safety.unnecessary_library_name: Discourages unnecessary library name declarations for cleaner code[1][4].
Lints Removed
avoid_null_checks_in_equality_operators: This removal gives developers more control over hownullis handled in equality checks[1][4].prefer_const_constructorsprefer_const_declarationsprefer_const_literals_to_create_immutables
These three "prefer_const_" lints were removed to simplify constant usage recommendations in Flutter projects, as they were sometimes seen as overly restrictive[1][4].
Removed in 4.0.0 (Still Absent in 5.0.0)
package_prefixed_library_nameslibrary_names
These were already removed in the shift from 3.0.2 to 4.0.0[1].
Added in 4.0.0 (Still Present Unless Otherwise Stated)
library_annotationsno_wildcard_variable_uses
What This Means for Your Project
- Upgrading to 5.0.0 may introduce new lint warnings related to JavaScript interop and unnecessary library name usage.
- Code that previously failed the removed lints (
prefer_const_*andavoid_null_checks_in_equality_operators) will no longer be flagged. - Projects must now use newer Flutter and Dart SDKs (at least Flutter 3.24 / Dart 3.5)[1][2][4].
Upgrading will keep your project aligned with the latest best practices and Dart ecosystem trends, and may lead to cleaner, more maintainable codebases[4].
Citations:
- 1: https://pub.dev/packages/flutter_lints/changelog
- 2: https://pub.dev/packages/flutter_lints/versions
- 3: https://github.com/FlutterGen/flutter_gen/blob/main/CHANGELOG.md
- 4: https://www.victorcarreras.dev/2024/10/whats-new-in-flutter-lints-500-key.html
- 5: https://docs.flutter.dev/release/breaking-changes/flutter-lints-package
- 6: https://gitlab.com/TheOneWithTheBraid/f_wallet/-/merge_requests/67
- 7: https://github.com/inway/flutter_ringtone_player/blob/main/CHANGELOG.md
- 8: error fluttercommunity/flutter_launcher_icons#606
- 9: https://github.com/flutter-form-builder-ecosystem/form_builder_validators/actions/runs/11050840691
- 10: https://community.flutterflow.io/c/whats-new-in-flutterflow/post/what-s-new-in-flutterflow-october-22-2024-SwPJhrzf93cjCkp
Update Dart/Flutter SDK Constraints & Address New Lint Rules
Please ensure the upgrade to flutter_lints: ^5.0.0 is fully supported:
• In packages/flutter/pubspec.yaml, bump your environment SDKs to meet the new minimums:
environment:
sdk: ">=3.5.0 <4.0.0"
flutter: ">=3.24.0"• Run
flutter pub upgrade
flutter analyzeto surface the two new lints:
invalid_runtime_check_with_js_interop_typesunnecessary_library_name
• Review and adjust any code patterns that relied on lints now removed:
avoid_null_checks_in_equality_operatorsprefer_const_constructorsprefer_const_declarationsprefer_const_literals_to_create_immutables
🤖 Prompt for AI Agents (early access)
In packages/flutter/pubspec.yaml at line 50, after updating flutter_lints to ^5.0.0, update the environment SDK constraints to sdk: ">=3.5.0 <4.0.0" and flutter: ">=3.24.0" to meet new minimum requirements. Then run flutter pub upgrade and flutter analyze to detect new lint warnings for invalid_runtime_check_with_js_interop_types and unnecessary_library_name. Finally, review and modify code to comply with these new lints and adjust any code relying on removed lints like avoid_null_checks_in_equality_operators and the prefer_const_* rules.
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.
🛠️ Refactor suggestion
Add documentation and consider using Dart's Uri class instead.
This class lacks documentation explaining its purpose and usage. Additionally, it appears to duplicate functionality that's already available in Dart's
Uriclass.class UrlReplace {Uriclass could be used directly🤖 Prompt for AI Agents (early access)