openInAr method

Future<void> openInAr()

Implementation

Future<void> openInAr() async {
  if (widget.onArPressed != null) {
    widget.onArPressed!();
    return;
  }
  final UArAvailability availability = await UAr.availability();
  final bool native = !availability.isSupported || kIsWeb && !availability.capabilities.webXr;
  if (native) {
    await UAr.openNativeViewer(UArNativeViewerOptions(source: widget.source, iosSource: widget.iosSource, title: widget.title));
    return;
  }
  await UArExperiences.place(
    items: <UArPlaceable>[UArPlaceable(id: "product", title: widget.title ?? "", source: widget.source, iosSource: widget.iosSource, surface: widget.arSurface, maxCount: 1)],
    labels: widget.labels,
    style: widget.style,
  );
}