Install the Splunk RUM Flutter agent
Use the Splunk RUM Flutter agent to instrument your Flutter applications.
Check compatibility and requirements
- Flutter 3.32.0 and above
- Dart 3.8.0 and above
- Android API 24 and above
- iOS 15 and above
This combination of minimum versions allows you to instrument your Flutter applications running on both Android and iOS.
Before you begin
Get this information:
-
Your Splunk access token: See Generate your RUM access token in Splunk Observability Cloud.
-
The name of the application that you're instrumenting.
-
(Optional) The version number of the application that you're instrumenting.
-
A name for the environment where the application will run.
Your application name, application version, and deployment environment should be non-identical strings.
Procedure
-
Install the Splunk RUM Flutter agent:
-
Add the SDK to your Flutter project:
BASHflutter pub add splunk_otel_flutter -
Refresh your Flutter project's dependencies:
BASHflutter pub get
-
-
Set up the "native" side:
- Android
-
Activate desugaring in your application:
-
In yor application module's build.gradle file, update the
compileOptionsanddependenciessections as in the following examples:GROOVYandroid { compileOptions { // Flag to enable support for the new language APIs // For AGP 4.1+ isCoreLibraryDesugaringEnabled = true // For AGP 4.0 // coreLibraryDesugaringEnabled = true // Sets Java compatibility to Java 8 sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { // If this setting is present, jvmTarget must be "1.8" jvmTarget = "1.8" } } dependencies { // For AGP 7.4+ coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.3") // For AGP 7.3 // coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.2.3") // For AGP 4.0 to 7.2 // coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.9") } - Save and sync your project.
-
- iOS
-
Enable Swift Package Manager for your Flutter project:
DARTflutter config --enable-swift-package-managerFor more information, see the official Flutter documentation on Swift Package Manager.
-
Initialize the agent in your
mainfunction:DARTimport 'package:splunk_otel_flutter/splunk_otel_flutter.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); await SplunkRum.instance.install( agentConfiguration: AgentConfiguration( endpointConfiguration: EndpointConfiguration.forRum( realm: "<inserted>", rumAccessToken: "<inserted>", ), appName: "<inserted>", deploymentEnvironment: "<inserted>", appVersion: "<inserted>", ), ); runApp(const MyApp()); } -
Generate some user activity in your application. To see your application in Splunk Observability Cloud, select Explore RUM.