Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates the OAuth provider buttons from using flutter_svg with inline SVG strings to using vector_graphics with precompiled SVG assets. It introduces a new OAuthProviderIcon widget to load and render these compiled assets. The review feedback suggests making assetsPackage nullable in ThemedOAuthProviderButtonStyle to support custom provider styles defined directly in the main application.
aebrahim
pushed a commit
to aebrahim/FirebaseUI-Flutter
that referenced
this pull request
Nov 18, 2026
## Description
The `firebase_ui_oauth` example app never calls `Firebase.initializeApp()`.
`OAuthProviderButtonBase` resolves `FirebaseAuth.instance` in `initState`, so
every button throws on startup ("Null check operator used on a null value"
from `Firebase.app()` on web) and the example renders error widgets instead
of the provider buttons.
This initializes Firebase with the example's existing
`firebase_options.dart`, matching the other example apps in the repo
(`firebase_ui_auth`, `firebase_ui_firestore`, `firebase_ui_database`,
`firebase_ui_storage`, `firebase_ui_localizations`).
### Verification
- `dart analyze --fatal-infos` reports no issues in the example.
- `flutter build web` succeeds. In a headless browser the app now renders
the Apple, Facebook, Google and Twitter buttons with their icons, with no
console errors. Before this change the button area was an error widget.
- `melos run analyze` and `melos run test:unit:all` pass.
## Related Issues
Found while testing firebase#752.
## Checklist
- [ ] 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.
- [x] All existing and new tests are passing.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] The analyzer (`melos run analyze`) does not report any problems on my PR.
- [x] 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
- [ ] Yes, this is a breaking change.
- [x] No, this is _not_ a breaking change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N9vW6UAypN8gghMxWzymfC
aebrahim
added a commit
to aebrahim/FirebaseUI-Flutter
that referenced
this pull request
Nov 18, 2026
The `firebase_ui_oauth` example app never calls `Firebase.initializeApp()`.
`OAuthProviderButtonBase` resolves `FirebaseAuth.instance` in `initState`, so
every button throws on startup ("Null check operator used on a null value"
from `Firebase.app()` on web) and the example renders error widgets instead
of the provider buttons.
This initializes Firebase with the example's existing
`firebase_options.dart`, matching the other example apps in the repo
(`firebase_ui_auth`, `firebase_ui_firestore`, `firebase_ui_database`,
`firebase_ui_storage`, `firebase_ui_localizations`).
- `dart analyze --fatal-infos` reports no issues in the example.
- `flutter build web` succeeds. In a headless browser the app now renders
the Apple, Facebook, Google and Twitter buttons with their icons, with no
console errors. Before this change the button area was an error widget.
- `melos run analyze` and `melos run test:unit:all` pass.
Found while testing firebase#752.
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] My PR includes unit or integration tests for _all_ changed/updated/fixed behaviors.
- [x] All existing and new tests are passing.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] The analyzer (`melos run analyze`) does not report any problems on my PR.
- [x] All unit tests pass (`melos run test:unit:all` doesn't fail).
- [x] I read and followed the Flutter Style Guide.
- [x] I signed the CLA.
- [x] I am willing to follow-up on review comments in a timely manner.
- [ ] Yes, this is a breaking change.
- [x] No, this is _not_ a breaking change.
10 of 11 tasks
aebrahim
force-pushed
the
feat/oauth-precompiled-svg-icons
branch
from
November 18, 2026 08:12
79a5ce7 to
89c0463
Compare
The OAuth provider buttons (Google, Apple, Facebook, Twitter) store their
icons as inline SVG strings and render them with `flutter_svg`
(`SvgPicture.string`). That means every app parses SVG at runtime and ships
`flutter_svg` plus the SVG parser it pulls in, even though the icons are known
at build time.
This PR moves the icons to SVG assets that are compiled into the
`vector_graphics` binary format by the `vector_graphics_compiler` asset
transformer when the app is built, and renders them with `VectorGraphic`.
Compiling at app build time (rather than committing precompiled `.vec` files)
keeps the binary output in sync with the `vector_graphics` / codec version
resolved by the consuming app.
- **firebase_ui_oauth**
- Replace the `flutter_svg` dependency with `vector_graphics`.
- Add `OAuthProviderIcon`, which loads `iconSrc` from `assetsPackage` via
`AssetBytesLoader`. It is used by the button and by
`ThemedOAuthProviderButtonStyle.iconWidget`. The `assetsPackage` getter,
which was previously unused, now drives icon loading.
- Make `assetsPackage` nullable (`String?`). Returning `null` loads icons
from the app's own bundle, so custom provider styles defined in an app
(rather than in a package) keep working. Subclasses returning `String`
still compile.
- Document how custom styles should declare their icon assets.
- **firebase_ui_oauth_{google,apple,facebook,twitter}**
- Move the inline SVG strings to `assets/icons/*.svg`, declared with the
`vector_graphics_compiler` transformer, and point `iconSrc` at them.
- Add `vector_graphics_compiler` as a regular dependency. Flutter runs the
transformer with `dart run` from the consuming app's directory, so it must
be resolvable from the app; as a `dev_dependency` the app build fails with
"Could not find package `vector_graphics_compiler`". The compiler is not
imported by any Dart code, so it is not compiled into apps.
- Google: the unused `assets/google_icon.svg` is moved to
`assets/icons/google.svg`.
- **Tests**: the `firebase_ui_oauth` widget tests now serve icon bytes
produced by `encodeSvg` and look for `VectorGraphic` instead of
`SvgPicture`. New tests check that `iconWidget` loads icons from
`packages/<assetsPackage>/...`, and from the app bundle when
`assetsPackage` is `null`.
- `melos run analyze` reports no issues in any workspace package.
- `melos run test:unit:all` passes: `flutter test` and
`flutter test --platform=chrome` in all 7 packages with tests.
- A standalone web app (outside the workspace) depending on
`firebase_ui_oauth_google` builds with `flutter build web --release`
without depending on the compiler itself, and the bundled
`google.svg` asset is the compiled binary (828 bytes).
- All four providers' icons render correctly in light and dark themes.
Note: after switching branches, `flutter test` may reuse stale assets from
`build/unit_test_assets`; delete that directory if icons render blank.
Fixes firebase#247
- [ ] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] My PR includes unit or integration tests for _all_ changed/updated/fixed behaviors.
- [x] All existing and new tests are passing.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] The analyzer (`melos run analyze`) does not report any problems on my PR.
- [x] 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.
- [x] Yes, this is a breaking change.
- [ ] No, this is _not_ a breaking change.
BREAKING CHANGE: `ThemedIconSrc` values returned by
`ThemedOAuthProviderButtonStyle.iconSrc` are now asset paths (relative to
`assetsPackage`) of SVG assets declared with the `vector_graphics_compiler`
asset transformer, instead of raw SVG strings, and `assetsPackage` is now
`String?`. Custom OAuth provider styles must move their SVGs to assets and
declare them with the transformer. A package declaring the assets must list
`vector_graphics_compiler` under `dependencies`; an app declaring them can
use `dev_dependencies` and return `null` from `assetsPackage`.
aebrahim
force-pushed
the
feat/oauth-precompiled-svg-icons
branch
from
November 18, 2026 08:13
89c0463 to
3fadf1f
Compare
aebrahim
added a commit
to aebrahim/FirebaseUI-Flutter
that referenced
this pull request
Nov 18, 2026
The Apple icon SVGs draw a full-size background rectangle behind the logo: pure black (`#000000`) in `apple_dark.svg` and pure white (`#FFFFFF`) in `apple_light.svg`. The Apple button itself is `#060708` on the dark variant, so a visibly different black square shows behind the logo. The icon also ignores `iconBackgroundColor`, because the rectangle always covers it. This removes the rectangles so the logo is drawn on a transparent background and blends with the button. The logo paths are unchanged. On the white variant there is no visible difference, since the rectangle was white on white. - Rendered the Apple button in the `firebase_ui_oauth` example app on web before and after. The square behind the logo on the black button is gone. - `melos run analyze` and `melos run test:unit:all` pass. Depends on firebase#752, which moves the Apple icons into `assets/icons/*.svg`. This PR is based on that branch; only the last commit is new. Please merge firebase#752 first. - [x] I read the Contributor Guide and followed the process outlined there for submitting PRs. - [x] My PR includes unit or integration tests for _all_ changed/updated/fixed behaviors. - [x] All existing and new tests are passing. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] The analyzer (`melos run analyze`) does not report any problems on my PR. - [x] All unit tests pass (`melos run test:unit:all` doesn't fail). - [x] I read and followed the Flutter Style Guide. - [x] I signed the CLA. - [s] I am willing to follow-up on review comments in a timely manner. - [ ] Yes, this is a breaking change. - [x] No, this is _not_ a breaking change.
10 of 11 tasks
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.
Description
The OAuth provider buttons (Google, Apple, Facebook, Twitter) store their icons as inline SVG strings and render them with
flutter_svg(SvgPicture.string). That means every app parses SVG at runtime and shipsflutter_svgplus the SVG parser it pulls in, even though the icons are known at build time.This PR moves the icons to SVG assets that are compiled into the
vector_graphicsbinary format by thevector_graphics_compilerasset transformer when the app is built, and renders them withVectorGraphic. Compiling at app build time (rather than committing precompiled.vecfiles) keeps the binary output in sync with thevector_graphics/ codec version resolved by the consuming app.Changes
flutter_svgdependency withvector_graphics.OAuthProviderIcon, which loadsiconSrcfromassetsPackageviaAssetBytesLoader. It is used by the button and byThemedOAuthProviderButtonStyle.iconWidget. TheassetsPackagegetter, which was previously unused, now drives icon loading.assets/icons/*.svg, declared with thevector_graphics_compilertransformer, and pointiconSrcat them.vector_graphics_compileras a regular dependency. Flutter runs the transformer withdart runfrom the consuming app's directory, so it must be resolvable from the app; as adev_dependencythe app build fails with "Could not find packagevector_graphics_compiler". The compiler is not imported by any Dart code, so it is not compiled into apps.assets/google_icon.svgis moved toassets/icons/google.svg.firebase_ui_oauthwidget tests now serve icon bytes produced byencodeSvgand look forVectorGraphicinstead ofSvgPicture.Verification
melos run analyzereports no issues in any workspace package.melos run test:unit:allpasses:flutter testandflutter test --platform=chromein all 7 packages with tests.firebase_ui_oauth_googlebuilds withflutter build web --releasewithout depending on the compiler itself, and the bundledgoogle.svgasset is the compiled binary (828 bytes).Note: after switching branches,
flutter testmay reuse stale assets frombuild/unit_test_assets; delete that directory if icons render blank.Related Issues
Fixes #247
Checklist
///).melos run analyze) does not report any problems on my PR.melos run test:unit:alldoesn't fail).Breaking Change
BREAKING CHANGE:
ThemedIconSrcvalues returned byThemedOAuthProviderButtonStyle.iconSrcare now asset paths (relative toassetsPackage) of SVG assets declared with thevector_graphics_compilerasset transformer, instead of raw SVG strings. Custom OAuth provider styles must move their SVGs to assets, declare them with the transformer, and addvector_graphics_compileras a dependency of the package that declares them.Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com