findByAlias method

  1. @override
Future<KeyRef> findByAlias(
  1. String alias
)

Implementation

@override
Future<KeyRef> findByAlias(String alias) async {
  try {
    final result = await _channel.invokeMethod<Map<Object?, Object?>>(
      'findByAlias',
      {'alias': alias, 'keyId': keyIdFromAlias(alias)},
    );
    if (result == null) {
      throw LocksmithKeyNotFound('Key alias not found: $alias');
    }
    return _refFromMap(result);
  } on PlatformException catch (e) {
    if (e.code == 'NOT_FOUND') {
      throw LocksmithKeyNotFound('Key alias not found: $alias');
    }
    rethrow;
  }
}