Skip to content

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

Open
Rexios80 wants to merge 3 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 3 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 the default (platform_oauth_sign_in.dart) is resolved, which pulls in desktop_webview_auth / dart:io and blocks Wasm 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, which still pulled dart:io into the Wasm graph. The barrel now re-exports the leaf libraries that declare the desktop types (AuthResult, ProviderArgs, and the Google/Facebook/Twitter sign-in args) instead of the public library that imports dart:io.

Fixing this in desktop_webview_auth itself is not viable: invertase/flutter_desktop_webview_auth is archived.

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.
Drop the web stubs and export the leaf libraries that declare the
desktop types, instead of the public library that imports dart:io.
@Rexios80

Copy link
Copy Markdown
Contributor Author

@kevmoo Can you help get this reviewed please? My https://pub.dev/packages/firebase_ui_oauth_oidc package is losing pub points because of this.

@kevmoo kevmoo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yes, please!

@Rexios80

Copy link
Copy Markdown
Contributor Author

Failed checks seem to be unrelated to this PR

@kevmoo

kevmoo commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

I'm not a "regular" maintainer of this repo, though. Hrm...Let me bother someone internally

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.

2 participants