-
-
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 3 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,34 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| part of '../../parse_server_sdk.dart'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class ParseAggregate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| final String className; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Map<String, 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}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Future<ParseResponse> execute() async { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Map<String,String> _pipeline={}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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])}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Future<ParseResponse> execute() async { | |
| Map<String,String> _pipeline={}; | |
| 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])}); | |
| } | |
| 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', | |
| ); | |
| } | |
| /// Executes the aggregate query and returns the response. | |
| /// | |
| /// Throws an [ArgumentError] if the pipeline is empty. | |
| /// Returns a [ParseResponse] containing the query results. | |
| Future<ParseResponse> execute() async { | |
| Map<String, String> queryParams = {}; | |
| 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 { | |
| queryParams.addAll({'pipeline': jsonEncode([pipeline])}); | |
| } | |
| final debugBool = isDebugEnabled(objectLevelDebug: debug); | |
| final result = await ParseObject(className)._client.get( | |
| Uri.parse('${ParseCoreData().serverUrl}$keyEndPointAggregate$className') | |
| .replace(queryParameters: queryParams) | |
| .toString(), | |
| ); | |
| // Use ParseCoreData().logger instead of print for debugging | |
| if (debugBool) { | |
| ParseCoreData().logger.info('Aggregate query result: ${result.data}'); | |
| } | |
| return handleResponse<ParseObject>( | |
| ParseObject(className), | |
| result, | |
| ParseApiRQ.get, | |
| debugBool, | |
| parseClassName ?? 'ParseBase', | |
| ); | |
| } |
🤖 Prompt for AI Agents (early access)
In packages/dart/lib/src/network/parse_aggregate.dart around lines 13 to 33, remove the debug print statement that outputs the result data. Rename the local variable _pipeline to a more descriptive name like queryParameters. Improve error handling by ensuring the pipeline parameter is properly validated and encoded before adding it to the query parameters. Make sure the pipeline is encoded as a JSON array and passed correctly in the request URI.
Outdated
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
❓ Verification inconclusive
Add test coverage for the new aggregate functionality.
The PR objectives mention that tests are planned but not yet implemented. Tests are essential for ensuring this new functionality works correctly.
Please ensure comprehensive test coverage is added for the ParseAggregate class, including tests for:
- Successful aggregation queries with various pipeline operations
- Error handling for empty pipelines
- Error handling for server-side errors
- Custom client and debug flag handling
🏁 Script executed:
#!/bin/bash
# Look for test files related to the aggregate functionality
fd -e dart "aggregate.*test"
# Check coverage in existing test files for references to ParseAggregate
rg -l "ParseAggregate" --type dart packages/dart/test/Length of output: 85
Add comprehensive test coverage for ParseAggregate
No existing tests for the new aggregate functionality were found. Please add tests in packages/dart/test/ covering:
- Successful aggregation with various pipeline operations (e.g.
$group,$match,$sort, etc.) - Error thrown when
pipelineis empty - Handling of server-side errors (simulate non-200 responses)
- Custom client injection and
debugflag behavior
Ensure these tests exercise both positive and negative scenarios and validate that execute() builds the correct request URI, encodes the pipeline properly, and invokes handleResponse as expected.
🤖 Prompt for AI Agents (early access)
In packages/dart/lib/src/network/parse_aggregate.dart lines 1 to 34, there is no test coverage for the ParseAggregate class. Add comprehensive tests in packages/dart/test/ that cover successful aggregation queries with different pipeline operations like $group, $match, and $sort; verify that an ArgumentError is thrown when the pipeline is empty; simulate server-side errors to test error handling; and test the behavior when a custom client and debug flag are provided. Ensure tests validate the correct request URI construction, proper JSON encoding of the pipeline, and that handleResponse is called correctly.
| 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, | ||
| }); | ||
|
|
||
| } | ||
|
Comment on lines
+1
to
+24
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. 🛠️ 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
-class UrlReplace{
+/// A container for URL components used for URL manipulation operations.
+/// This class provides a convenient way to store and pass URL components.
+class UrlReplace {
/// The URL scheme (e.g., 'http', 'https')
String? scheme;
/// The user info portion of the URL
String? userInfo;
/// The host name
String? host;
/// The port number
int? port;
/// The path component of the URL
String? path;
/// The path segments as an iterable collection
Iterable<String>? pathSegments;
/// The query string
String? query;
/// The query parameters as a map
Map<String, dynamic>? queryParameters;
/// The fragment identifier
String? fragment;
+ /// Creates a new UrlReplace instance with the specified URL components.
UrlReplace({
this.scheme,
this.userInfo,
this.host,
this.port,
this.path,
this.pathSegments,
this.query,
this.queryParameters,
this.fragment,
});
}🤖 Prompt for AI Agents (early access) |
||
| 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
Enhance the ParseAggregate example with error handling and documentation
The example demonstrates the new aggregation query feature, but could be improved with error handling and better documentation.
Consider adding error handling and more descriptive output:
🤖 Prompt for AI Agents (early access)