-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[local_auth] Adopt structured errors, and remove useErrorDialogs
#9981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[local_auth] Adopt structured errors, and remove useErrorDialogs
#9981
Conversation
@tarrinneal Please review everything other than the Android and iOS changes. |
There was a problem hiding this comment.
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 is a significant and well-executed refactoring of the local_auth
plugin. It successfully replaces PlatformException
with a more robust, structured LocalAuthException
, and removes the useErrorDialogs
option, giving developers more control over the user experience. The changes are consistently applied across all supported platforms, and the public API of the local_auth
package is cleaner as a result. My review includes a few minor suggestions to improve the example applications to better demonstrate handling of the new exception type.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Switches from
PlatformException
s to newLocalAuthException
s, which contain structured error information (specifically, a code that is a documented enum, rather than a list of magic strings that are used inconsistently and not all documented), bringing the plugin into alignment with [our current best practices](https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#platform-exception-handling. In addition to being clearer and easier to use for clients, this adds significantly more granular error codes than we currently have, which allows clients to better handle specific cases.Since this must be done as a breaking change (since the current
PlatformException
s are a combination of documented and de-facto API), this batches another breaking change, which is removing the error dialogs from the plugin, for the reasons described in flutter/flutter#175125.Since this is adding far more specific error codes, the PR also makes the internal change of passing essentially all native failure cases across the language boundary and then doing mapping to the cross-platform codes in Dart code, in keeping with our general recent practice of moving logic to the Dart side when there's no need for it to be native.
Fixes flutter/flutter#113687
Fixes flutter/flutter#175125
Fixes flutter/flutter#151513
Fixes flutter/flutter#132757
Fixes flutter/flutter#148947
Fixes flutter/flutter#173506
Fixes flutter/flutter#174191
Closes flutter/flutter#96646
Fixes flutter/flutter#117810
Closes flutter/flutter#141283
Closes flutter/flutter#173142
Pre-Review Checklist
[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///
).Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3