Skip to content

fix(ui_oauth): use dart.library.js_interop for Wasm-compatible imports - #675

Open
Rexios80 wants to merge 2 commits into
firebase:mainfrom
Rexios80:fix/oauth-wasm-js-interop-conditional
Open

fix(ui_oauth): use dart.library.js_interop for Wasm-compatible imports#675
Rexios80 wants to merge 2 commits into
firebase:mainfrom
Rexios80:fix/oauth-wasm-js-interop-conditional

Conversation

@Rexios80

@Rexios80 Rexios80 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

OAuthProvider selects its platform sign-in implementation with a conditional import gated on dart.library.html. That library is unavailable when compiling to Wasm, so pana/pub.dev resolves the default (platform_oauth_sign_in.dart) which pulls in desktop_webview_auth / dart:io, costing the WASM platform points for firebase_ui_oauth and dependents (e.g. firebase_ui_oauth_oidc).

This PR switches that condition to dart.library.js_interop, which is present for both JS and Wasm web compiles, so the web implementation is selected correctly.

The public library also re-exported desktop_webview_auth unconditionally. Pana's Wasm check follows every public export with no pruning, so that barrel export still pulled dart:io into the graph after the conditional import fix. Desktop types (AuthResult, ProviderArgs, and the Google/Facebook/Twitter sign-in args) are now re-exported only on IO, with web/Wasm stubs that do not import dart:io.

Related Issues

N/A — improves Wasm readiness / pub points for firebase_ui_oauth and packages that depend on it.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • All unit tests pass (melos run test:unit:all doesn't fail).
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Replace dart.library.html with dart.library.js_interop so the web
platform_oauth_sign_in implementation is selected under Wasm, where
dart.library.html is unavailable.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the conditional import in oauth_provider.dart to check for dart.library.js_interop instead of dart.library.html. I have no feedback to provide as there are no review comments.

Unconditional barrel exports still pulled dart:io into pana's Wasm check
after the js_interop conditional import. Re-export those types only on
IO, and stub them on web.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant