getPose method

Future<Matrix4?> getPose(
  1. ARAnchor anchor
)

Returns the given anchor pose in Matrix4 format with respect to the world coordinate system of the ARView

Implementation

Future<Matrix4?> getPose(ARAnchor anchor) async {
  try {
    if (anchor.name.isEmpty) {
      throw Exception("Anchor can not be resolved. Anchor name is empty.");
    }
    final serializedCameraPose =
        await _channel.invokeMethod<List<dynamic>>('getAnchorPose', {
      "anchorId": anchor.name,
    });
    return MatrixConverter().fromJson(serializedCameraPose!);
  } catch (e) {
    print('Error caught: ' + e.toString());
    return null;
  }
}