getCredentials static method

Future<List<Credential>> getCredentials()

Get all current credentials for this device.

NOTE: only one credential per device is supported currently.

Implementation

static Future<List<Credential>> getCredentials() async {
  List<dynamic>? credentialListMap = await _channel.invokeListMethod("getCredentials");
  List<Credential> credentialList = List.empty(growable: true);

  if (credentialListMap != null) {
    try {
      credentialList = credentialListMap.map((cred) => Credential.mapToCredential(cred)).toList();
    } on Exception {
      rethrow;
    }
  } else {
    throw Exception("Error getting credentials from platform");
  }

  return credentialList;
}