AnnotationViewBuilder typedef

AnnotationViewBuilder = Widget Function(BuildContext context, ArAnnotation annotation)

Signature for a function that creates a widget for a given annotation.

ArView re-sorts and re-filters annotations on every sensor update, so their position in the rendered list is not stable across frames. To keep Flutter's element reconciliation correct despite that reordering, ArView already wraps the returned widget in a RepaintBoundary keyed with ValueKey(annotation.uid) — you do not need to (but may) key the widget you return here yourself.

The builder is not called on every frame: ArView reuses the widget it returned until the annotation's ArAnnotation.distanceFromUser or its grouped annotations change, or until ArView is rebuilt by its parent. While the device moves, labels are only moved with a transform: they are neither rebuilt, laid out nor repainted. Widgets depending on inherited widgets (theme, media query...) through the given context are still rebuilt when those change.

Implementation

typedef AnnotationViewBuilder =
    Widget Function(BuildContext context, ArAnnotation annotation);