chore(supabase_lints): enable avoid-unnecessary-nullable return-type & parameters#1429
Open
spydon wants to merge 3 commits into
Open
chore(supabase_lints): enable avoid-unnecessary-nullable return-type & parameters#1429spydon wants to merge 3 commits into
spydon wants to merge 3 commits into
Conversation
…and parameters Fix the non-breaking sites and enable both rules: - _parseMediaType returns a non-null MediaType (parse never returns null). - _widgetsBindingInstance returns a non-null WidgetsBinding; callers drop the now-redundant null-aware access. - _initSupabaseAuthClient takes a required non-null autoRefreshToken (the only caller always passes AuthClientOptions.autoRefreshToken, a bool). - The platform_io condPlatform/condPlatformVersion/condRuntimeVersion getters are non-null (the IO implementation never returns null; the stub stays nullable for web). Two sites keep an inline ignore because their nullability is required: local_storage_stub.accessToken must match the web implementation's String?, and _copyWithType's headers parameter relies on null to fall back to the existing headers.
grdsdev
approved these changes
Jun 18, 2026
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.
Stacked on #1427.
What
Enables
avoid-unnecessary-nullable-return-typeandavoid-unnecessary-nullable-parameters. Per the v3 split in #1428, this PR only does the non-breaking fixes; genuinely breaking changes stay deferred to v3.Fixed (9 sites, all non-breaking / internal)
storage_client_parseMediaType-> returns non-nullMediaType(MediaType.parsenever returns null).supabase_flutter_widgetsBindingInstance-> non-nullWidgetsBinding; the two callers drop the now-redundant?.(modern Flutter'sWidgetsBinding.instanceis non-null).supabase_initSupabaseAuthClient->required bool autoRefreshToken(the sole caller always passesAuthClientOptions.autoRefreshToken, a non-nullbool).supabase+supabase_flutterplatform_io.dart:condPlatform/condPlatformVersion/condRuntimeVersion-> non-null. The IO implementation never returns null; the conditional-import stub stays nullable (web can be null), and the publicConstants.platformis unchanged (String?).Inline ignores (2 — nullability is required, not unnecessary)
supabase_flutterlocal_storage_stub.accessToken: the throw-stub must keepString?to match the web implementation (localStorage.getItemis nullable).postgrest_copyWithType'sheadersparameter: relies onnull(the default) to fall back to?? _headers; making it non-null would change behavior.Verification
dcm analyze packages-> no issues found (including no unused-ignores).dart analyzeclean (lib + test) across packages;flutter analyze --fatal-warningsclean.platform_iochange passes.)Note
The genuinely breaking nullable-related changes are tracked in #1428 (added to the v3 umbrella #1278).