getPasskeys static method Null safety

Future<List<Passkey>> getPasskeys()

Get all current passkeys for this device.

Returns a List of Passkeys

Implementation

static Future<List<Passkey>> getPasskeys() async {
  List<dynamic>? passkeyListMap =
      await _channel.invokeListMethod("getPasskeys");
  List<Passkey> passkeyList = List.empty(growable: true);

  if (passkeyListMap != null) {
    try {
      passkeyList = passkeyListMap
          .map((passkey) => Passkey.mapToPasskey(passkey))
          .toList();
    } on Exception {
      rethrow;
    }
  } else {
    throw Exception("Error getting passkeys from platform");
  }

  return passkeyList;
}