refactor: dedupe bucket payload and OAuth launch logic - #1463
Merged
Conversation
- Extract the duplicated bucket request payload in StorageBucketApi (createBucket/updateBucket) into _bucketPayload. - Extract the duplicated OAuth/identity-link launch logic in SupabaseAuth (signInWithOAuth/linkIdentity) into _launchAuthUrl. Also removes two stale avoid-unnecessary-type-assertions ignores in postgrest_builder (unused per the DCM version used in CI; pre-existing failure on main).
grdsdev
approved these changes
Jun 24, 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.
What
Two more duplicated blocks extracted into helpers:
storage_client—createBucketandupdateBucketbuilt the same request payload map. Extracted into_bucketPayload(id, bucketOptions).supabase_flutter—signInWithOAuthandlinkIdentityhad identical launch logic (parse URL, force external browser for Google on Android,launchUrl). Extracted into_launchAuthUrl(url, provider, authScreenLaunchMode).No behavior change.
Verification
dart analyze libanddcm analyzepass with no issues for both packages.supabase_fluttertests pass (51) and allstorage_clientunit tests pass. (The storage integration tests fail locally only because they need a running storage server:Connection refused.)Note: This branch also removes two stale
avoid-unnecessary-type-assertionsignores inpostgrest_builder.dart. They are flagged as unused by the DCM version used in CI (a pre-existing failure onmain, present on every PR). Including it keeps this PR's pipeline green; it drops out cleanly once another PR carrying the same fix lands.