All Products
Search
Document Center

Cloud Monitor:Integrate a Flutter application

Last Updated:Mar 31, 2026

Real User Monitoring (RUM) provides a Flutter plugin to monitor iOS and Android applications. This topic shows you how to integrate the Flutter plugin.

Prerequisites

  • Flutter: 3.0.0+

  • iOS: 12.0+

  • Android: 7.0+

Step 1: Integrate the Flutter plugin

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

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

    flutter packages get
  3. For iOS applications, run the following command in the ios directory of your project to update the Pod environment.

    pod install
  4. Initialize the Flutter SDK.

    1. In the main.dart file, import the following packages.

      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 capturing action events, such as clicks, in Flutter. You need to configure and use AlibabaCloudActionCapture to capture user click events. The following is 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 returns [INFO][AlibabaCloudRUM]: alibabacloud_rum_flutter_plugin start success, the SDK is successfully integrated.

    Sample output:

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

Step 2: Integrate native SDKs

In addition to the Flutter plugin, you must integrate the native SDKs for Android, iOS into your Flutter project. For more information, see the following topics:

References