logInteraction static method

void logInteraction(
  1. String widgetName, {
  2. String interactionType = InteractionTypes.tap,
  3. Map<String, String>? attributes,
})

Records an instantaneous ui.interaction span for widgetName and opens the action window so spans created in the next actionWindowDuration parent to this interaction.

widgetName identifies the widget the user acted on and is emitted as app.widget.name; blank values fall back to unknown. interactionType is emitted as interaction.type — use an InteractionTypes value, and for InteractionTypes.gesture add a gesture.type entry to attributes. app.widget.source is always flutter.

Entries in attributes cannot override those three keys. screen.name is stamped automatically by ScreenNameSpanProcessor; passing it in attributes overrides that value for this span only.

Ordering contract — call this before navigating

The tap → navigation → screen-load chain only forms if this is called before Navigator.push in the same handler:

onTap: () {
  VuTelemetry.logInteraction('Errors card');
  Navigator.of(context).push(...);   // ui.navigation nests under the tap
}

Navigating without logging first leaves ui.navigation as its own trace root — correct, but the tap that caused it is not linked.

The span itself is instantaneous: it ends before the work it parents begins, so its own duration is not the action's duration. The window, not the span, is what adopts the following actionWindowDuration of work.

Implementation

static void logInteraction(
  String widgetName, {
  String interactionType = InteractionTypes.tap,
  Map<String, String>? attributes,
}) {
  user_interaction.logInteraction(
    widgetName,
    interactionType: interactionType,
    attributes: attributes,
  );
}