The Flutter Agent monitors Flutter mobile applications. This page covers how to instrument the Flutter Agent in your Flutter application project.

Instrument the Flutter Agent

To instrument the Flutter Agent:

  1. Add the Flutter Agent to your project: 

    flutter pub add appdynamics_agent
  2. Start the instrumentation at the start of the application (usually in main.dart):

    import 'package:appdynamics_agent/appdynamics_agent.dart';
    import 'package:flutter/material.dart';
    Future<void> main() async {
      final config = AgentConfiguration(
          appKey: "<EUM_APP_KEY>",
          loggingLevel: LoggingLevel.verbose, // optional, for better debugging.
          collectorURL: "<COLLECTOR_URL>", // optional, mostly on-premises. 
          screenshotURL: "<SCREENSHOT_URL>" // optional, mostly on-premises.
      await Instrumentation.start(config);
      runApp(const MyApp());
  3. (Android apps only) Add the following configurations:

    1. Add the following changes to android/build.gradle:

      dependencies {
      classpath "com.appdynamics:appdynamics-gradle-plugin:22.2.2"
      // ... other dependencies
    2. Apply the adeum plugin to the bottom of the android/app/build.gradle file: 

      dependencies {
      // ... project dependencies
      // Bottom of file
      apply plugin: 'adeum'
    3. Add the following permissions to your AndroidManifest.xml file (usually in android/src/main/):

      <manifest xmlns:android=""
      <!-- add these two permissions -->
      <uses-permission android:name="android.permission.INTERNET" />
      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
      <!-- other settings -->

Next Steps

To further customize how data is collected and reported, see Customize the Flutter Instrumentation.