All Products
Search
Document Center

Application Real-Time Monitoring Service:Connect to a Flutter application

Last Updated:Dec 20, 2025

The Alibaba Cloud Real User Monitoring (RUM) Flutter plugin supports the Android, iOS, and HarmonyOS platforms.

Version requirements

  • Flutter: 3.0.0+

  • iOS: 12.0+

  • Android: 7.0+

Step 1: Integrate the Flutter plugin

  1. Add the dependency to the pubspec.yaml configuration file.

    dependencies:
      flutter:
        sdk: flutter
    
      alibabacloud_rum_flutter_plugin: ^2.1.0
  2. In the root directory of your Flutter project, run the following command to install the plugin.

    flutter packages get
  3. If you have an iOS application, run the following command in the ios directory of your project to install the pods.

    pod install
  4. Initialize the Flutter SDK.

    1. Import the following package in the main.dart file.

      import 'package:alibabacloud_rum_flutter_plugin/alibabacloud_rum_flutter_plugin.dart';
    2. Initialize the SDK.

      void main() {
        // Comment out the original runApp() method
        // runApp(MyApp());
        // (Required) Initialize the SDK
        AlibabaCloudRUM().start(MyApp());
        // (Optional) Set a custom username
        AlibabaCloudRUM().setUserName("xxxxxx");
      }
  5. (Optional) Collect action events.

    The RUM Flutter plugin supports the collection of action events, such as clicks. To collect user click events, you can configure and use AlibabaCloudActionCapture. The following code shows an example:

    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return AlibabaCloudActionCapture(
              child: Scaffold(
              appBar: AppBar(
                title: const Text('AlibabaCloudRUM'),
              ),
              body: // Your other code
            ));
      }
    }
  6. Verify the plugin integration.

    Start the Flutter application. If the DEBUG CONSOLE displays the message [INFO][AlibabaCloudRUM]: alibabacloud_rum_flutter_plugin start success, the SDK has been successfully integrated.

    The following output is an example:

    flutter: [2024-05-27 16:43:39][INFO][AlibabaCloudRUM]: alibabacloud_rum_flutter_plugin start success

Step 2: Integrate native SDKs

Integrating the Alibaba Cloud RUM SDK into a Flutter project requires you to integrate both the Flutter plugin and the native SDKs for Android, iOS, and HarmonyOS. For integration instructions, see the following documents:

References