-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Closed as not planned
Closed as not planned
Copy link
Labels
r: duplicateIssue is closed as a duplicate of an existing issueIssue is closed as a duplicate of an existing issue
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Possibly related to #125214
Steps to reproduce
local_auth_android 1.0.23
- getAvailableBiometrics produces Unhandled Exception: PlatformException on some Android models.
local_auth_android 1.0.21
- Does not produce PlatformException error.
Expected results
_availableBiometrics = await _localAuth.getAvailableBiometrics();
should not return PlatformException error.
Actual results
PlatformException(channel-error, Unable to establish connection on channel., null, null)
Code sample
import 'package:flutter/material.dart';
import 'package:local_auth/local_auth.dart';
import 'package:flutter/services.dart';
import 'dart:io' show Platform;
class BiometricsDataSource {
final _localAuth = LocalAuthentication();
List<BiometricType>? _availableBiometrics;
bool isPlatformSupportedByLocalAuth =
Platform.isAndroid || Platform.isIOS || Platform.isWindows;
Future<bool> isAvailable() async {
if (!isPlatformSupportedByLocalAuth) {
return false;
}
late List<BiometricType> _availableBiometrics;
try {
_availableBiometrics = await _localAuth.getAvailableBiometrics();
} on PlatformException catch (e) {
debugPrint('[ERROR] local_auth getAvailableBiometrics: ${e}');
return false;
}
if (await _localAuth.isDeviceSupported() &&
await _localAuth.canCheckBiometrics &&
_availableBiometrics.isNotEmpty
) {
return true;
} else {
return false;
}
}
}
Logs
I/flutter (12402): [ERROR] local_auth getAvailableBiometrics: PlatformException(channel-error, Unable to establish connection on channel., null, null)
Doctor output
[✓] Flutter (Channel stable, 3.7.11, on [redacted])
• Flutter version 3.7.11 on channel stable at [redacted]
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f72efea43c (9 days ago), 2023-04-11 11:57:21 -0700
• Engine revision 1a65d409c7
• Dart version 2.19.6
• DevTools version 2.20.1
Metadata
Metadata
Assignees
Labels
r: duplicateIssue is closed as a duplicate of an existing issueIssue is closed as a duplicate of an existing issue