Skip to content

How to capture TTFD for widgets that are not part of Navigation? #3355

@SAGARSURI

Description

@SAGARSURI

Problem Statement

The documentation at https://docs.sentry.io/platforms/dart/guides/flutter/integrations/routing-instrumentation/ explains how to capture TTFD (Time To Full Display) for widgets that are loaded through navigation (using Navigator.push or GoRouter).

However, it doesn't cover how to capture TTFD for widgets that are NOT part of navigation - for example:

  • Widgets that are conditionally rendered within a page
  • Dynamically loaded content sections
  • Tab views within a screen
  • Any other widgets that appear without a route change

Can you provide guidance on whether TTFD tracking is supported for these non-navigation scenarios, and if so, how to implement it?

Solution Brainstorm

Possible solutions could include:

  1. Extend SentryDisplayWidget - Allow SentryDisplayWidget to work independently of navigation, so it can be wrapped around any widget that needs TTFD tracking.

  2. Manual Span Creation API - Provide a way to manually create TTFD spans for custom scenarios:

    final span = Sentry.startTTFDSpan(name: 'Portfolio Tab');
    // ... load content ...
    span.reportFullyDisplayed();
  3. Documentation Enhancement - If TTFD is currently only supported for navigation scenarios, clearly document this limitation and explain the reasoning (e.g., tying it to transaction boundaries).

  4. Custom Display Tracking - Provide examples of how developers can implement their own TTFD-like tracking for non-navigation widgets using custom spans.

This would be particularly useful for complex apps where significant UI loading happens within a single route.

Are you willing to submit a PR?

None

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions