getTouchIDAuthenticationAllowableReuseDuration method

Future<double> getTouchIDAuthenticationAllowableReuseDuration()

Retrieves the allowable reuse duration for Touch ID authentication (iOS/macOS only).

On iOS and macOS, this method allows you to retrieve the allowable duration for reusing a previously authenticated Touch ID (fingerprint) to unlock an app or perform secure actions. This duration is specified in seconds.

This method is applicable only to iOS and macOS platforms. On other platforms, it throws an error indicating that the method is not supported.

Returns a Future with a double value representing the allowable reuse duration. If the operation is successful, it returns the specified duration value previously set using setTouchIDAuthenticationAllowableReuseDuration.

Example usage (iOS/macOS):

double allowableReuseDuration = await getTouchIDAuthenticationAllowableReuseDuration();
// Allowable reuse duration retrieved successfully
print("Allowable reuse duration: $allowableReuseDuration seconds");

Throws an exception if there's an issue with retrieving the allowable reuse duration.

Note: This method may not be available on all versions of iOS or macOS, so it's important to check for platform compatibility before using it.

Implementation

Future<double> getTouchIDAuthenticationAllowableReuseDuration() async {
  if (Platform.isIOS || Platform.isMacOS) {
    return await FlutterLocalAuthenticationPlatform.instance
        .getTouchIDAuthenticationAllowableReuseDuration();
  }
  return Future.value(0.0);
}