firebase_phone_auth_handler 2.0.1
firebase_phone_auth_handler: ^2.0.1 copied to clipboard
An easy-to-use firebase phone authentication package to easily send and verify OTP's with auto-fetch OTP support via SMS. Supports web out of the box.
2.0.1 - 2026-08-08 #
- Maintenance release; no user-facing changes.
2.0.0 - 2026-08-08 #
- BREAKING: Updated
firebase_authto^6.5.6. This package re-exportsfirebase_auth, so its breaking changes apply here too. - BREAKING: Raised the minimum SDK to Dart 3.8 / Flutter 3.32, as required by
firebase_auth6. - BREAKING: iOS apps now need a minimum deployment target of 15.0.
firebase_auth6 pulls in Firebase 12, whosefirebase-authandfirebase-corepackages require iOS 15. RaiseIPHONEOS_DEPLOYMENT_TARGET(and theplatform :iosline in your Podfile, if you still use CocoaPods) or the build fails with a "Target Integrity" error. - BREAKING: Added
controller.otpSendStatus, anOtpSendStatusenum (idle,sending,sent,failed), as the single source of truth for the send operation.codeSentandisSendingCoderemain as convenience shorthands, now derived from it. The one break is thatcodeSentis a getter rather than a settable field, so any code assigning to it will no longer compile — assigning to it always desynced the controller from reality. - BREAKING: Fixed
isSendingCodereportingtruefor a controller that had never sent anything. It was defined as!codeSent, so two booleans could not express "idle" or "failed" — a UI gated on it showed a "sending OTP" loader that never cleared whensendOtpOnInitializewasfalseor when a send failed. Switch onotpSendStatusto tell those states apart. - BREAKING: Removed
FirebasePhoneAuthProvider.FirebasePhoneAuthHandlercreates and owns its own controller, so delete the widget from your tree — usually it wrappedMaterialApp. Each handler now gets a fresh controller that is disposed when the handler unmounts, so a verification session can no longer leak into the next screen and two handlers mounted at once can no longer overwrite each other's state. The one capability removed is reading the controller from a widget that is not inside a handler, since there is no app-wide instance any more; use the controller passed tobuilder, orcontext.watch<FirebasePhoneAuthController>()from within it. - BREAKING: Removed
controller.clear(). It existed only to reset the shared app-wide controller between handlers, which no longer happens — disposal now handles teardown. Calling it left the controller without a phone number and therefore unusable, so it was a footgun rather than a useful reset. - BREAKING:
FirebasePhoneAuthHandler.signOut()no longer takes aBuildContext. It resolved the controller through the provider only to reachFirebaseAuth.instance.signOut(). Drop the argument, or passauth:when using a secondary Firebase app. - Added an
authparameter toFirebasePhoneAuthHandler, so you can authenticate against a secondaryFirebaseApprather than the default one. It also gives tests a seam to inject a fake instead of reaching the real SDK. The instance is resolved lazily, so constructing a controller still never requiresFirebase.initializeApp. - Exported
OnLoginSuccess,OnLoginFailedandOnError. They appear in the public API but were not reachable, so callers could not name them. - Added a
codeSendTimeoutargument tosendOTP, defaulting to 60 seconds. Firebase does not guarantee that it calls back at all — when device verification cannot complete (for example on Android with no SHA-1 registered and no reCAPTCHA site key configured for the project) neithercodeSentnorverificationFailedever fires, and the controller previously stayed in "sending" forever behind a loader that never cleared. On timeoutotpSendStatusbecomesfailed,onErrorreceives aTimeoutExceptionexplaining the likely cause, andsendOTPreturns false. Passnullto wait indefinitely. - Updated
providerto^6.1.5+1. - Fixed
onLoginFailedbeing called twice for a single failure when phone number verification failed andsendOTPwas awaiting the code send. - Fixed
autoRetrievalTimeOutDurationandotpExpirationDurationleaking between handlers. They were held in static fields, so mounting a second handler overwrote the first one's durations. - Fixed the OTP expiration and auto-retrieval timers not being cancelled when a new OTP was requested. The previous timers kept firing for the lifetime of the app and each resend added another pair.
- Fixed an unhandled asynchronous error when verification failed and
sendOTPwas called withshouldAwaitCodeSendset tofalse. - Fixed instant verification being reported as a failure. When firebase resolves a number without sending an SMS,
verificationCompletedfires butcodeSentmay not, so the code-send timeout kept running and would later flip a successful login tofailed— and an awaitingsendOTPwould hang until it did. - Fixed
otpSendStatusnot rebuilding listeners when it changed tosent— three of the four places that set it were assigning the field directly instead of going through the notifying setter, so a widget switching onotpSendStatuscould miss the transition out ofsending. - The controller now cancels its timers when it is disposed, and no longer notifies listeners after disposal.
- Controller teardown now happens in the handler's
disposerather thandeactivate, so a live verification session is no longer wiped when the widget is merely moved within the tree. linkWithExistingUsernow reports a descriptive error when no user is signed in, instead of a bare null check failure.- Added a test suite covering controller state and widget wiring.
- Added Android and iOS setup sections to the README. Android covers the SHA-1/SHA-256 certificate fingerprints that phone auth requires (including the Play App Signing key, which is easy to miss and breaks phone auth only once the app is live) and what the missing-fingerprint failure looks like. iOS covers the custom URL scheme that phone auth requires, the deep-linking interaction that otherwise pushes a bogus
/link?deep_link_id=...route over your OTP screen, the iOS 15 deployment target, and how to test on the simulator. - Updated the example app for current Flutter APIs (
DialogThemeData,AppBarTheme.backgroundColor) and bumped its dependencies. - Modernised the example's Android build (Gradle 8.14.5, AGP 8.13.0, Kotlin 2.3.20, Java 11) and removed a hand-pinned 2022 Firebase BoM that conflicted with the version
firebase_auth6 resolves. If your own project is still on an older Gradle or AGP, expect to make the same move — Flutter 3.32+ requires Gradle 8.7 or newer, and warns below 8.14. - Added a screenshot to the package listing, so pub.dev now shows a thumbnail in search results and a gallery on the package page.
- README: the screenshots are now served from this repository instead of GitHub's attachment CDN, which was outside the repo's control and could have gone stale.
- Consolidated the screenshot assets into one
screenshots/folder —screenshots/published/(ships, referenced by pubspec'sscreenshots:) andscreenshots/unpublished/(README-only, excluded via a.pubignorecovering the whole folder rather than naming files, so a future addition there is excluded by default instead of shipping if someone forgets to list it). They previously lived split acrosspub_screenshots/and.github/assets/. Verified withpub publish --dry-runthat the published folder is archived and the unpublished one is not. - README: dropped the
popularitybadge, which had stopped rendering, and thecode sizeone, which wasn't telling anyone much; added monthly downloads, and portfolio/publisher badges linking to the author's other work. - README: replaced the Collaborators table, inaccurate for a solo package, with an Author section.
- CI: the release workflow now re-resolves and commits
example/pubspec.lockafter bumping the version, so the example's lockfile — which records this package's version since it depends on it by path — no longer goes stale until the next local build rewrites it. - CI: renamed the publish workflow to "Publish to pub.dev (auto-run by Release)" so the Actions sidebar makes the handoff from Release obvious, rather than it looking like a second entry point.
- CI: bumped
actions/checkoutto v7. v4 ran on Node 20, which GitHub deprecated, so every release run carried a force-run-on-Node-24 warning. sendOTPnow throws aStateErrorinstead of silently returningfalsewhen called on a controller with no phone number configured. This is only reachable by constructingFirebasePhoneAuthControllerdirectly and bypassingFirebasePhoneAuthHandler— but in that exact case,_setDatanever ran either, soonError/onLoginFailedare unset too, and afalsereturn previously failed with no signal anywhere.recaptchaVerifierForWebProvideris now only invoked on web. It was previously called on every platform (with the result simply discarded on non-web), which risked constructing aRecaptchaVerifierwhere the underlying platform channel doesn't exist.
1.1.2 - 2026-07-28 #
- Maintenance release; no user-facing changes.
1.1.1 - 2026-07-28 #
- Added GitHub Actions CI to automate version bumps, changelog updates, tagging and pub.dev publishing.
1.1.0+1 - 2025-01-25 #
- Fix dart static analysis warnings
1.1.0 - 2024-10-07 #
- Updated README.md
- Updated dependencies
- Updated example app
1.0.8 - 2023-01-20 #
- Added sendOtpOnInitialize parameter to the handler
- Fixed OTP resend issue if the OTP expiration timer is still active
- Fixed #15
- Added shouldAwaitCodeSend to the sendOTP fn to give more control over the function
- Updated dependencies
1.0.7 - 2022-10-24 #
- Stacktrace in onLoginFailed is now non-nullable
- Updated a dependency to the latest release
- Updated example app
1.0.6 - 2022-07-16 #
- BREAKING: Added stack trace to onLoginFailed and onError callbacks
- Added a boolean linkWithExistingUser to link the new credentials with an existing signed-in user, instead of creating a new one.
- Added onError callback for general purpose errors by the library
- Updated example app
- Updated dependencies
1.0.5+1 - 2022-07-11 #
- Fixed files formatting
- Updated example app
1.0.5 - 2022-07-10 #
- BREAKING: Renamed flag timeOutDuration to autoRetrievalTimeOutDuration
- BREAKING: Renamed verifyOTP to verifyOtp
- BREAKING: Updated verifyOtp function signature to not take a named argument, and accept otp as a positional argument
- Added a new otpExpirationDuration flag, as autoRetrievalTimeOutDuration is a completely different parameter.
- Added callback onCodeSent and flag signOutOnSuccessfulVerification
- Added isSendingCode flag to controller
- Optimized code to reduce number of rebuilds
- Updated example app
- Updated dependencies
- Refactored code
1.0.4 - 2022-06-07 #
- Updated example app
- Updated dependencies
- Fixed linter warnings
1.0.3 - 2022-05-03 #
- Updated example app
- Updated README.md
1.0.2 - 2022-04-30 #
- Renamed auth_service to auth_controller
- Updated dependencies
- Minor bug fixes
- Updated example app
- Updated README.md
1.0.1 - 2022-01-26 #
- Updated license
- Updated README.md
1.0.0 - 2022-01-26 #
- Added linter and updated code accordingly
- Updated example app
- Updated dependencies
- Updated README.md
0.0.8 - 2021-10-28 #
- Updated dependencies
- Updated example app
0.0.7 - 2021-05-22 #
- Renamed FirebasePhoneAuthSupporter to FirebasePhoneAuthProvider.
- Supports sending OTP on web out of the box.
- Updated dependencies
- Updated README.md
- Updated package description.
0.0.6 - 2021-05-12 #
- Added key parameter
- Fixed README.md
- Updated dependencies
0.0.5 - 2021-04-23 #
- Added boolean in onLoginSuccess to provide info whether OTP was auto fetched or verified manually
- Updated example app
- Updated README.md
0.0.4 - 2021-04-21 #
- Updated example app
- Updated README.md
0.0.3 - 2021-04-21 #
- Updated screenshots
- Updated package description
0.0.2 - 2021-04-21 #
- Added FirebasePhoneAuthSupporter which has to be wrapped above the MaterialApp in order for the app to support phone authentication.
- Fixed sign out function
- Updated README.md
0.0.1 - 2021-04-20 #
- An easy to use firebase phone authentication library to easily send and verify OTP's.
