logTabChange static method

void logTabChange(
  1. String name, {
  2. String? group,
  3. String? trigger,
  4. bool foldIntoScreenName = true,
})

Records a tab / bottom-nav destination change by name.

The escape hatch for surfaces with no controller and nothing to wrap. Call it alongside your setState:

onDestinationSelected: (i) {
  setState(() => _navIndex = i);
  VuTelemetry.logTabChange(_destinations[i]);
}

Emits a tab_switch span and makes screen.name Page>Name. Pass group when a screen has more than one tab surface, so the two do not overwrite each other. trigger is reported as navigation.trigger and defaults to tap.

Prefer VuIndexScope when the selection lives in a field you can pass to it — it emits from didUpdateWidget, so it cannot be forgotten on one of several code paths that change the index.

Set foldIntoScreenName to false on a shell whose branches are already distinct routes, so screen.name stays the visible branch instead of becoming a composite like HomeBranch>Search. It applies only to the call that first registers group on the current page: the flag is fixed for the group's lifetime, so a group a VuTabScope or an observed controller already created keeps its own setting.

Implementation

static void logTabChange(
  String name, {
  String? group,
  String? trigger,
  bool foldIntoScreenName = true,
}) {
  tab_tracking.logTabChange(
    name,
    group: group,
    trigger: trigger,
    foldIntoScreenName: foldIntoScreenName,
  );
}