Dynatrace Flutter Plugin Integration Skill
Prerequisites
- Flutter SDK installed and available on
- An existing Flutter project with a at the project root
- A Dynatrace environment with access to Experience Vitals (to obtain and , or to download )
- Console access to Experience Vitals → Mobile to configure app settings (Data Privacy, Enablement and Cost Control)
- 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
Before asking the user anything, check whether
exists at the project root.
- File exists: Read it, show the and , and confirm they match the target environment. If correct, run the check below and skip to Step 3.
- File does not exist: Proceed to Step 2.
Inspect the file for
(Android) and
(iOS).
- Present on both platforms: Trust the value as-is. If , flag Step 7a. If , 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 .
Step 2 — Obtain (only if Step 1 found no file)
Ask the user which approach they prefer:
Option A — Download from console (recommended):
- Open their Dynatrace environment
- Navigate to: Experience Vitals → New Frontend → Mobile
- Enter app name and choose Flutter as the platform
- 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.
- Download and place it at the project root (same level as )
Once the file is in place, apply the
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
check and flag Step 7a if needed.
Step 3 — Add the dependency
- Not present: Run:
bash
flutter pub add dynatrace_flutter_plugin
- Already under : No change — proceed to Step 4.
- Under : Remove it from , 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
, dependencies are already fetched — skip this step.
Otherwise run:
Confirm success before continuing.
Step 5 — Run the Dynatrace configuration script
bash
dart run dynatrace_flutter_plugin
This reads
and automatically configures Android Gradle and
. 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 / or — not needed
Step 6 — Bootstrap the SDK in
dart
import 'package:dynatrace_flutter_plugin/dynatrace_flutter_plugin.dart';
import 'package:flutter/material.dart';
void main() {
Dynatrace().start(const MyApp());
}
- calls internally — remove any separate call
WidgetsFlutterBinding.ensureInitialized()
is not required by Dynatrace before , but keep it if your app needs it for other pre-start initialization (for example, plugin or platform setup)
- Do not itself; only use for other app initialization that must complete before calling
Step 7 — Add navigation tracking
In the root
or
, add
DynatraceNavigationObserver()
to
:
dart
MaterialApp(
navigatorObservers: [DynatraceNavigationObserver()],
...
)
dart
CupertinoApp(
navigatorObservers: [DynatraceNavigationObserver()],
...
)
Step 7a — Privacy options call (only if )
Skip this step if was not set to during Steps 1 or 2.
Read
references/user-opt-in.md
for the full guidance on
,
, 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
for the
package dependency. Separately, search the codebase for
and
usages. If either is present, apply instrumentation:
| Package | Instrumentation |
|---|
| Dynatrace().createHttpClient()
— replace at the construction site |
| Manual timing via Dynatrace().createWebRequestTiming(...)
— no drop-in wrapper exists |
accepts an optional
parameter to wrap an existing client instance. Find every
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
is
or absent):
- ✅ Crash reporting
- ✅ User action tracking
- ✅ Network monitoring
- ✅ Lifecycle monitoring
- ✅ Auto-start
When
, 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 template with Grail and userOptIn conditional blocks
references/user-opt-in.md
— guidance, options, placement options
references/verification.md
— Post-setup verification checklist and troubleshooting
External References
- dynatrace_flutter_plugin on pub.dev — package changelog, API docs, and latest version
- Dynatrace Flutter Installation Docs — initial setup docs