chore: adopt null-aware elements now that minimum Dart SDK is 3.9#1531
Open
spydon wants to merge 2 commits into
Open
chore: adopt null-aware elements now that minimum Dart SDK is 3.9#1531spydon wants to merge 2 commits into
spydon wants to merge 2 commits into
Conversation
Enable the previously SDK-gated prefer-null-aware-elements DCM rule and rewrite all collection literals using null-aware elements (?element) instead of if (x != null) guards. Keep the dot-shorthand rules disabled and correct their comment: dot shorthands are still an experimental language feature, not stabilized in 3.9, so code targeting the 3.9 floor cannot use them.
…e-elements # Conflicts: # packages/realtime_client/lib/src/types.dart
Vinzent03
approved these changes
Jul 3, 2026
Vinzent03
left a comment
Collaborator
There was a problem hiding this comment.
I immediately thought about the supabase packages when I read the release notes back then. Great to finally make use of it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Now that the minimum Dart SDK is 3.9, this adopts the null-aware elements language feature (stabilized in Dart 3.8) across the codebase.
prefer-null-aware-elementsDCM rule insupabase_lints.?element) instead ofif (x != null)guards:if (prefer != null) prefer→?preferif (email != null) 'email': email→'email': ?emailif (grantTypes != null) 'grant_types': grantTypes!.map(...)→'grant_types': ?grantTypes?.map(...)Dot shorthands
The config previously claimed the three dot-shorthand rules needed "Dart 3.9". That is inaccurate: dot shorthands are still an experimental language feature and cannot be used by code targeting the 3.9 floor (verified:
Color c = .green;still errors at language 3.9 on Dart 3.12). Those rules stay disabled, and their comment is corrected to reflect this.Verification
dcm analyze packages examples→ 0prefer-null-aware-elementsviolationsdart analyze→ clean across all touched packagesdart format→ no reformatting neededrealtime_clientmock_test.dartpasses (including thewith filtercase that exercises a changed path)