[Alpha] Install the Splunk RUM Flutter agent

Use the Splunk RUM Flutter agent to instrument your Flutter applications.

Attention:

Alpha features described in this document are provided by Splunk to you "as is" without any warranties, maintenance and support, or service-level commitments. Splunk makes this alpha feature available in its sole discretion and may discontinue it at any time. These documents are not yet publicly available and we ask that you keep such information confidential. Use of alpha features is subject to the Splunk Pre-Release Agreement for Hosted Services.

Summary

With Splunk Real User Monitoring (RUM), you can gain insight about the performance and health of your front-end user application. To get started, instrument your Flutter application automatically by installing the Splunk RUM Flutter agent as outlined below.

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.

Note: Splunk APM is not required to use Splunk RUM for Flutter applications.

Before you begin

Get this information:

Your application name, application version, and deployment environment should be non-identical strings.

Procedure

  1. Install the Splunk RUM Flutter agent:

    1. Add the SDK to your Flutter project:

      flutter pub add splunk_otel_flutter
    2. Refresh your Flutter project's dependencies:

      flutter pub get
  2. Set up the "native" side:

    For Android, activate desugaring in your application
    1. In yor application module's build.gradle file, update the compileOptions and dependencies sections as in the following examples:

      android {
          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")
      }
    2. Save and sync your project.
    iOS
    Not applicable.
  3. Initialize the agent in your main function.Dart:

    import 'package:splunk_otel_flutter/splunk_otel_flutter.dart';
    
    void main() async {
      WidgetsFlutterBinding.ensureInitialized();
      await SplunkOtelFlutter.instance.install(
        agentConfiguration: AgentConfiguration(
          endpointConfiguration: EndpointConfiguration.forRum(
            realm: "<inserted>",
            rumAccessToken: "<inserted>",
          ),
          appName: "<inserted>",
          deploymentEnvironment: "<inserted>",
          appVersion: "<inserted>", 
        ),
      );
      runApp(const MyApp());
    }
  4. Generate some user activity in your application. To see your application in Splunk Observability Cloud, select Digital Experience > Real user monitoring > Overview.