Instrument the Flutter Agent
To instrument the Flutter Agent:
- Add the Flutter Agent to your project:
flutter pub add appdynamics_agent
- 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 { WidgetsFlutterBinding.ensureInitialized(); 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()); }
- (Android apps only) Add the following configurations:
- Add the following changes to android/build.gradle:
dependencies { classpath "com.appdynamics:appdynamics-gradle-plugin:24.12.0" // ... other dependencies }
- Apply the adeum plugin to the bottom of the android/app/build.gradle file:
dependencies { // ... project dependencies } // Bottom of file apply plugin: 'adeum'
- Add the following permissions to your AndroidManifest.xml file (usually in android/src/main/):
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myawesomepackage"> <!-- add these two permissions --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <application> <!-- other settings -->
- Add the following changes to android/build.gradle: