Skip to content

Conversation

@stuartmorgan-g
Copy link
Collaborator

Platform interface portion of #9981

  • Adds the new LocalAuthException class for structured errors.
  • Deprecates AuthenticationOptions.useErrorDialogs

Part of:

Pre-Review Checklist

Footnotes

  1. 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

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 introduces structured error handling to the local_auth platform interface by adding a new LocalAuthException class and a LocalAuthExceptionCode enum. This is a valuable improvement as it allows for more granular and consistent error handling across platforms. The contract of the authenticate method has been clarified in the documentation to reflect these changes. Additionally, the useErrorDialogs option in AuthenticationOptions is now deprecated. The changes are well-structured and include necessary updates to tests, the changelog, and pubspec. I have one minor suggestion to enhance the new exception class for better debuggability.

final Object? details;

@override
String toString() => 'LocalAuthException(code $code, $description, $details)';

Choose a reason for hiding this comment

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

medium

For better readability and consistency with Dart conventions, it's good practice for toString() to return a string that resembles a constructor call with named parameters. Using code.name for the enum value will also produce a cleaner output, which is helpful for debugging.

Suggested change
String toString() => 'LocalAuthException(code $code, $description, $details)';
String toString() => 'LocalAuthException(code: ${code.name}, description: $description, details: $details)';

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I adjusted to follow the Flutter style for toString, using objectRuntimeType, which I had forgotten to do. Flutter style doesn't do named arguments for everything, but I did add the .name for code.

Copy link
Contributor

@tarrinneal tarrinneal left a comment

Choose a reason for hiding this comment

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

one typo and lgtm

/// such as no biometric sensor on device, will still result in
/// a [PlatformException].
// This parameter still exists for backwards compatibility with local_auth
// 2.x, but implementers targetting local_auth 3.x or later should ignore it,
Copy link
Contributor

Choose a reason for hiding this comment

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

targeting

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 30, 2025
@auto-submit auto-submit bot merged commit 321a584 into flutter:main Sep 30, 2025
80 checks passed
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Oct 1, 2025
flutter/packages@287739d...321a584

2025-09-30 [email protected] [local_auth] Adopt structured errors
- platform interface (flutter/packages#10023)
2025-09-30 [email protected] Revert hardcoded compilesdk back to
`flutter.compileSdkVersion` in `camera_android` (flutter/packages#9668)
2025-09-30 [email protected] [file_selector] updates build
files to use JVM 17 (flutter/packages#10097)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
okorohelijah pushed a commit to okorohelijah/flutter that referenced this pull request Oct 7, 2025
…r#176357)

flutter/packages@287739d...321a584

2025-09-30 [email protected] [local_auth] Adopt structured errors
- platform interface (flutter/packages#10023)
2025-09-30 [email protected] Revert hardcoded compilesdk back to
`flutter.compileSdkVersion` in `camera_android` (flutter/packages#9668)
2025-09-30 [email protected] [file_selector] updates build
files to use JVM 17 (flutter/packages#10097)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: local_auth

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants