Skip to main content
skill CX Codex

dt-setup-flutter — Claude Code skill: what it does, how to install

Integrates the Dynatrace plugin into Flutter projects: automates dependency configuration and sets up app startup instrumentation.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Dynatrace/dynatrace-for-ai --skill dt-setup-flutter -a claude-code
Open on GitHub

What dt-setup-flutter does

The skill inspects the project root for dynatrace.config.yaml or guides configuration via Dynatrace Experience Vitals. It inserts dynatrace_flutter_plugin into dependencies inside pubspec.yaml. The package must live under dependencies rather than dev_dependencies because monitoring is required at runtime in release builds.

Native build setup is automated. Running dart run dynatrace_flutter_plugin updates Android Gradle files and Info.plist without manual edits. Inside lib/main.dart, the skill replaces runApp() with Dynatrace().start(), registers DynatraceNavigationObserver on the root app widget, and configures createHttpClient().

Prerequisites include the Flutter SDK, dart on your PATH, and Dynatrace credentials such as applicationId and beaconUrl. Querying frontend RUM analytics is outside its scope; use dt-obs-frontends for telemetry queries instead.

What it helps with

  • add dynatrace_flutter_plugin to Flutter dependencies
  • generate dynatrace.config.yaml with mobile credentials
  • initialize the SDK by replacing runApp with Dynatrace().start
  • track screen navigation using DynatraceNavigationObserver
  • instrument HTTP clients for mobile network monitoring

Example prompts for the agent

  • Integrate Dynatrace into this Flutter project
  • Set up dynatrace_flutter_plugin and configure navigation observers
  • Instrument our HTTP client calls for Dynatrace monitoring

How to install dt-setup-flutter

1Skills CLI (Vercel)

npx skills add Dynatrace/dynatrace-for-ai --skill dt-setup-flutter -a claude-code

2Manually: put the files in place

~/.claude/skills/dt-setup-flutter/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/dt-setup-flutter/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about dt-setup-flutter

How do I install dt-setup-flutter in Claude Code?

Run npx skills add Dynatrace/dynatrace-for-ai --skill dt-setup-flutter -a claude-code in your terminal.

What does dt-setup-flutter do?

It guides mobile instrumentation for Dynatrace in Flutter apps, automating native build settings, SDK bootstrap in main.dart, and route tracking.

Do I need to edit Android or iOS build files manually?

No. The integration executes dart run dynatrace_flutter_plugin, which configures Gradle and Info.plist automatically.

Source text

SKILL.md · Apache-2.0
---
name: dt-setup-flutter
license: Apache-2.0
description: >-
  Integrate the Dynatrace Flutter Plugin into a Flutter project — dependency setup, config,
  SDK bootstrap, navigation tracking, and verification.
  Trigger: "add Dynatrace to Flutter", "Flutter plugin setup", "instrument Flutter app",
  "integrate Dynatrace Flutter", "mobile observability Flutter", "dynatrace_flutter_plugin".
  Do NOT use for: querying Flutter RUM data (use dt-obs-frontends), non-Flutter mobile setups,
  or Dynatrace server-side configuration.
---

# Dynatrace Flutter Plugin Integration Skill

## Prerequisites

- Flutter SDK installed and `flutter` available on `PATH`
- An existing Flutter project with a `pubspec.yaml` at the project root
- A Dynatrace environment with access to Experience Vitals (to obtain `applicationId` and `beaconUrl`, or to download `dynatrace.config.yaml`)
- Console access to Experience Vitals → Mobile to configure app settings (Data Privacy, Enablement and Cost Control)
- `dart` CLI available (comes with Flutter SDK; used to run the plugin configuration script)

Work through the steps below in order, interacting with the user at each decision point. Read actual project files before suggesting changes — do not assume the current state.

## Step 1 — Check for existing `dynatrace.config.yaml`

Before asking the user anything, check whether `dynatrace.config.yaml` exists at the project root.

- **File exists:** Read it, show the `applicationId` and `beaconUrl`, and confirm they match the target environment. If correct, run the `userOptIn` check below and skip to Step 3.
- **File does not exist:** Proceed to Step 2.

**`userOptIn` check:**

Inspect the file for `userOptIn` (Android) and `DTXUserOptIn` (iOS).

- **Present on both platforms:** Trust the value as-is. If `true`, flag Step 7a. If `false`, skip Step 7a.
- **Absent from either platform:** Ask the user: **"Do you have User Opt-In mode enabled or disabled?"** (If unsure: Experience Vitals → Mobile → [Your App] → Settings → Data Privacy.) Add the missing value to the relevant platform(s), then flag Step 7a if the final value is `true`.

## Step 2 — Obtain `dynatrace.config.yaml` (only if Step 1 found no file)

Ask the user which approach they prefer:

**Option A — Download from console (recommended):**

1. Open their Dynatrace environment
1. Navigate to: Experience Vitals → New Frontend → Mobile
1. Enter app name and choose **Flutter** as the platform
1. On the **Select capability and settings** screen, configure monitoring features (Crash reporting, user action monitoring, etc.). User action monitoring can be changed later via Experience Vitals → [App] → Settings → Enablement and Cost Control.
1. Download `dynatrace.config.yaml` and place it at the project root (same level as `pubspec.yaml`)

Once the file is in place, apply the `userOptIn` check from Step 1 and flag Step 7a if needed.

**Option B — Provide credentials manually:**
Read `references/config-yaml.md` for the full template and conditional blocks. Collect all required values from the user before creating any files, then apply the `userOptIn` check and flag Step 7a if needed.

## Step 3 — Add the dependency

Read `pubspec.yaml` first.

- **Not present:** Run:
  ```bash
  flutter pub add dynatrace_flutter_plugin
  ```
- **Already under `dependencies`:** No change — proceed to Step 4.
- **Under `dev_dependencies`:** Remove it from `dev_dependencies`, then run `flutter pub add dynatrace_flutter_plugin`. The plugin is required at runtime, including in release builds.

## Step 4 — Fetch dependencies

If Step 3 ran `flutter pub add`, dependencies are already fetched — skip this step.

Otherwise run:

```bash
flutter pub get
```

Confirm success before continuing.

## Step 5 — Run the Dynatrace configuration script

```bash
dart run dynatrace_flutter_plugin
```

This reads `dynatrace.config.yaml` and automatically configures Android Gradle and `ios/Runner/Info.plist`. No manual native file edits are needed.

Common mistakes to flag and correct:

- `flutter pub run dynatrace_flutter_plugin` — wrong, use `dart run dynatrace_flutter_plugin`
- Manual edits to `build.gradle` / `build.gradle.kts` or `Info.plist` — not needed

## Step 6 — Bootstrap the SDK in `main.dart`

Read `lib/main.dart`. Replace `runApp(...)` with `Dynatrace().start(...)`:

```dart
import 'package:dynatrace_flutter_plugin/dynatrace_flutter_plugin.dart';
import 'package:flutter/material.dart';

void main() {
  Dynatrace().start(const MyApp());
}
```

- `Dynatrace().start()` calls `runApp` internally — remove any separate `runApp` call
- `WidgetsFlutterBinding.ensureInitialized()` is not required by Dynatrace before `start()`, but keep it if your app needs it for other pre-start initialization (for example, plugin or platform setup)
- Do not `await` `Dynatrace().start()` itself; only use `await` for other app initialization that must complete before calling `start()`

## Step 7 — Add navigation tracking

In the root `MaterialApp` or `CupertinoApp`, add `DynatraceNavigationObserver()` to `navigatorObservers`:

```dart
MaterialApp(
  navigatorObservers: [DynatraceNavigationObserver()],
  ...
)
```

```dart
CupertinoApp(
  navigatorObservers: [DynatraceNavigationObserver()],
  ...
)
```

## Step 7a — Privacy options call (only if `userOptIn: true`)

**Skip this step if `userOptIn` was not set to `true` during Steps 1 or 2.**

Read `references/user-opt-in.md` for the full guidance on `DataCollectionLevel`, `crashReportingOptedIn`, and placement options. Ask the user the questions defined there, then apply the call to the relevant file.

## Step 8 — HTTP instrumentation (if applicable)

Check `pubspec.yaml` for the `http` package dependency. Separately, search the codebase for `import 'dart:io'` and `HttpClient` usages. If either is present, apply instrumentation:

| Package | Instrumentation |
|---|---|
| `http` | `Dynatrace().createHttpClient()` — replace `http.Client()` at the construction site |
| `dart:io HttpClient` | Manual timing via `Dynatrace().createWebRequestTiming(...)` — no drop-in wrapper exists |

`createHttpClient()` accepts an optional `client:` parameter to wrap an existing client instance. Find every `http.Client()` construction site in the project and replace it with `Dynatrace().createHttpClient()`.


If none are present, note it for when network calls are added.

## Step 9 — Post-setup summary

Confirm to the user what is active:

**Enabled by default** (when `userOptIn` is `false` or absent):

- ✅ Crash reporting
- ✅ User action tracking
- ✅ Network monitoring
- ✅ Lifecycle monitoring
- ✅ Auto-start

> When `userOptIn: true`, all data collection — including crash reporting — is gated on the `applyUserPrivacyOptions(...)` call.

**Configured during this setup:**

- Privacy mode: [userOptIn: true — consent call added / opt-out (SDK default)]
- Navigation tracking: [DynatraceNavigationObserver added]
- HTTP instrumentation: [applied / not applicable yet]

## Step 10 — Verification

Read `references/verification.md` and show the user the verification checklist. If no data appears after 5 minutes, work through the troubleshooting steps in that file.

## Reference Files

- `references/config-yaml.md` — Full `dynatrace.config.yaml` template with Grail and userOptIn conditional blocks
- `references/user-opt-in.md` — `applyUserPrivacyOptions` guidance, `DataCollectionLevel` options, placement options
- `references/verification.md` — Post-setup verification checklist and troubleshooting

## External References

- [dynatrace_flutter_plugin on pub.dev](https://pub.dev/packages/dynatrace_flutter_plugin) — package changelog, API docs, and latest version
- [Dynatrace Flutter Installation Docs](https://docs.dynatrace.com/docs/observe/digital-experience/new-rum-experience/mobile-frontends/flutter/id-01-initial-setup) — initial setup docs

© Dynatrace · Apache-2.0 · Dynatrace/dynatrace-for-ai

Similar skills

Everything for Mobile →

From the same set29

dt-platform-costs Analyzes actual Dynatrace DPS consumption and spend directly from dt.system.events via DQL. Helps teams track cost drivers and chargeback. CX Codex +1 1,400installs dt-obs-ext-monitors Sends third-party test outcomes and CI monitor results to Dynatrace Grail through the events ingest API. Replaces the deprecated synthetic v1 endpoint. CX Codex +1 1,100installs dt-sec-ioc-hunting Hunts indicators of compromise from reports and advisories across Dynatrace logs and spans, then scores threat exposure from 0 to 100. CX Codex +1 1,000installs dt-obs-network-flows A Dynatrace skill that reads network flows from three sources and answers who talks to whom and where connections break. CX Codex +1 912installs dt-obs-network-devices This skill reads SNMP monitoring data in Dynatrace: device inventory, interface state, topology and logs. Useful when a port is down or a switch is saturated. CX Codex +1 907installs dt-obs-compliance-assistant Monitors EU DORA compliance posture using Dynatrace Compliance Assistant. It inspects compliance scores, Critical or Important Functions, and incidents. CX Codex +1 889installs dt-setup-react-native Configures the Dynatrace plugin in React Native or Expo projects, handling Babel transformations, config files, and privacy options. CX Codex +1 860installs dt-setup-android Instruments an Android app with the Dynatrace Mobile Agent for initial telemetry. Configures Gradle files, agent credentials, and user privacy opt-in. CX Codex +1 857installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor