findById method

  1. @override
Future<KeyRef> findById(
  1. String keyId
)

Implementation

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