authenticators property Null safety

Set<Authenticator> authenticators

The available authenticators.

Note that this may also include authenticators that cannot be used to complete the operation.

All the available authenticators are returned so that the users of the SDK can figure out not only whether an account authenticator can be used for the operation, but also why. For example, a developer would like to give a visual hint explaining why the Fingerprint authenticator for a given user cannot be used during authentication if it is not registered: by using Authenticator.registration this situation can be identified.

The following snippet can be used to identify whether the authenticator can be used or not with a given account (identified by its username):

bool _isValid(
  Authenticator authenticator,
  String username,
  AccountSelectionContext context,
) {
    final Registration registration = authenticator.registration;
    // This method will filter the authenticators that are no supported
    // by the hardware, those not registered, and those that are compliant
    // with the server policy.
    return registration.isRegistered(username) &&
      authenticator.isSupportedByHardware &&
      context.isPolicyCompliant(authenticator.aaid);
}

Returns all the available authenticators. See: Authenticator.registration, Authenticator.isSupportedByHardware, isPolicyCompliant

Implementation

Set<Authenticator> get authenticators;