> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flashduty.com/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`

## 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                   |

## 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 the site's endpoint (`FlashcatSite.cn` → `browser.flashcat.cloud`); on-premises deployments can override it through `customEndpoint`
