> ## Documentation Index
> Fetch the complete documentation index at: https://test-8ad8522e-feat-ai-sre.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Flutter SDK data collection

> Learn about the event types, fields, and upload behavior collected by the Flutter RUM SDK

This page describes which data the Flutter SDK collects, how it is uploaded, and how to control the collection scope. All events write `source: "flutter"`.

## Event types

| Event     | Trigger                                                             | Description                                                                                 |
| --------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| view      | Route change (`DatadogNavigationObserver`) or manual API            | One page visit, recording load time and the number of internal actions / resources / errors |
| action    | Automatic recognition by `RumUserActionDetector` or `rum.addAction` | User interaction (tap / scroll / swipe / custom), can correlate frustration signals         |
| resource  | `enableHttpTracking()` or `DatadogClient`                           | One network request, recording URL, method, status code, duration, and size                 |
| error     | Automatic (unhandled exceptions / native crashes) or `rum.addError` | Errors and crashes, including type, message, and stack                                      |
| long task | `detectLongTasks` enabled by default                                | Main-thread blocking that exceeds `longTaskThreshold` (default 0.1s)                        |

## Automatically collected context

Each event automatically carries the following context (collected by the native layer):

* **Application information**: `service`, `version`, `env`, and `application.id`
* **Device information**: device model, operating system and version, screen size
* **Session information**: `session.id`, sampled by `sessionSamplingRate`
* **Connection information**: network type (when available)
* **User information**: `usr.id` / `usr.name` / `usr.email` set through `setUserInfo`

## Performance data

The console displays the Performance page for Flutter applications and supports the following native iOS / Android performance data:

| Metric                        | Platform      | Description                                                                                                                                       |
| ----------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| App start (TTID)              | iOS / Android | Time from application launch until the initial screen is displayed                                                                                |
| Refresh rate                  | iOS / Android | View rendering smoothness                                                                                                                         |
| Memory                        | iOS / Android | Memory usage while the application is running                                                                                                     |
| ANR                           | Android       | Application Not Responding events; the Android version determines the default for non-fatal ANRs, which you can override with `trackNonFatalAnrs` |
| App Hang                      | iOS           | Main-thread hang events; requires `appHangThreshold` and is disabled by default                                                                   |
| Flutter build / raster timing | iOS / Android | Requires explicitly setting `reportFlutterPerformance: true`                                                                                      |

App start, refresh-rate, and memory vitals are controlled by `vitalUpdateFrequency`, which defaults to `VitalsFrequency.average`; set it to `null` to disable them. `reportFlutterPerformance` controls only Flutter frame build / raster timings and is disabled by default. It does not affect these native vitals.

## Manual instrumentation

In addition to automatic collection, you can manually record events and attributes.

```dart theme={null}
final rum = DatadogSdk.instance.rum;

// Manually manage views
rum?.startView('checkout', 'Checkout');
rum?.stopView('checkout');

// Manually record an action
rum?.addAction(RumActionType.tap, 'pay_button');

// Manually report an error
rum?.addErrorInfo('payment failed', RumErrorSource.source);

// Attach a global attribute (written to all subsequent events)
rum?.addAttribute('tenant', 'acme');
```

## Sampling and control

| Configuration              | Default                   | Description                                                                                                            |
| -------------------------- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `sessionSamplingRate`      | 100.0                     | Session sampling rate (percentage); unsampled sessions produce no RUM data                                             |
| `traceSampleRate`          | 100.0                     | Sampling rate for distributed tracing on resources                                                                     |
| `telemetrySampleRate`      | 20.0                      | Sampling rate for the SDK's own telemetry                                                                              |
| `detectLongTasks`          | true                      | Whether to collect long tasks                                                                                          |
| `trackFrustrations`        | true                      | Whether to generate frustration signals from user actions                                                              |
| `trackAnonymousUser`       | true                      | Whether to generate an anonymous ID for signed-out users                                                               |
| `vitalUpdateFrequency`     | `VitalsFrequency.average` | Collection frequency for native mobile performance metrics; set to `null` to disable                                   |
| `reportFlutterPerformance` | false                     | Whether to collect Flutter build / raster timings                                                                      |
| `trackNonFatalAnrs`        | Platform default          | Whether to collect non-fatal ANRs; disabled by default on Android 30+ and enabled by default on Android 29 and earlier |
| `appHangThreshold`         | null                      | iOS App Hang threshold in seconds; `null` disables collection                                                          |

## Data masking

Event mappers let you modify or drop data before events are reported, for masking or filtering out noise. See <a href="/en/rum/sdk/flutter/advanced-config">Advanced configuration</a>.

```dart theme={null}
DatadogRumConfiguration(
  applicationId: '<APPLICATION_ID>',
  resourceEventMapper: (event) {
    // Return null to drop the event, or return it after modification
    return event;
  },
);
```

## Upload behavior

* The SDK batches and caches at the native layer, uploading in batches by `batchSize` and `uploadFrequency`
* When the network is unavailable, events are persisted locally and retried after recovery
* The upload endpoint defaults to `https://browser.flashcat.cloud/api/v2/rum`; on-premises deployments can set `customEndpoint` to the full RUM intake URL (it must include `/api/v2/rum` and preserve any deployment path prefix)
