requestHint method

Future<Credential?> requestHint({
  1. bool? isEmailAddressIdentifierSupported,
  2. bool? isPhoneNumberIdentifierSupported,
  3. String? accountTypes,
  4. bool? showAddAccountButton,
  5. bool? showCancelButton,
  6. bool? isIdTokenRequested,
  7. String? idTokenNonce,
  8. String? serverClientId,
})

Implementation

Future<Credential?> requestHint({
  // Enables returning credential hints where the identifier is an email address,
  // intended for use with a password chosen by the user.
  bool? isEmailAddressIdentifierSupported,
  // Enables returning credential hints where the identifier is a phone number,
  // intended for use with a password chosen by the user or SMS verification.
  bool? isPhoneNumberIdentifierSupported,
  // The list of account types (identity providers) supported by the app.
  // typically in the form of the associated login domain for each identity provider.
  String? accountTypes,
  // Enables button to add account
  bool? showAddAccountButton,
  // Enables button to cancel request
  bool? showCancelButton,
  // Specify whether an ID token should be acquired for hints, if available for the selected credential identifier.This is enabled by default;
  // disable this if your app does not use ID tokens as part of authentication to decrease latency in retrieving credentials and credential hints.
  bool? isIdTokenRequested,
  // Specify a nonce value that should be included in any generated ID token for this request.
  String? idTokenNonce,
  //Specify the server client ID for the backend associated with this app.
  // If a Google ID token can be generated for a retrieved credential or hint,
  // and the specified server client ID is correctly configured to be associated with the app,
  // then it will be used as the audience of the generated token. If a null value is specified,
  // the default audience will be used for the generated ID token.
  String? serverClientId,
}) async {
  if (_isAndroid(Methods.requestHint)) {
    try {
      final res = await _channel.invokeMethod(Methods.requestHint, {
        'isEmailAddressIdentifierSupported':
            isEmailAddressIdentifierSupported,
        'isPhoneNumberIdentifierSupported': isPhoneNumberIdentifierSupported,
        'accountTypes': accountTypes,
        'isIdTokenRequested': isIdTokenRequested,
        'showAddAccountButton': showAddAccountButton,
        'showCancelButton': showCancelButton,
        'idTokenNonce': idTokenNonce,
        'serverClientId': serverClientId,
      });
      if (res == null) return null;
      final Map<String, dynamic> map =
          jsonDecode(jsonEncode(res)) as Map<String, dynamic>;
      return Credential.fromJson(map);
    } catch (error) {
      debugPrint('Pinput/SmartAuth: requestHint failed: $error');
      return null;
    }
  }
  return null;
}