Installation and initialization

To integrate AppMetrica into Flutter, use the AppMetrica SDK for Flutter plugin:

Step 1. Install the AppMetrica SDK for Flutter plugin in your project

From the root of the project, run the command:

flutter pub add appmetrica_plugin

After adding the plugin, you'll see a line with the following dependency in the pubspec.yaml file:

dependencies:
   appmetrica_plugin: ^3.1.0

Step 2. Initialize the library

  1. Add appmetrica_plugin import:

    import 'package:appmetrica_plugin/appmetrica_plugin.dart';
    
  2. Initialize the AppMetrica library using AppMetrica.activate and your API key:

    AppMetrica.activate(AppMetricaConfig("insert_your_api_key_here"));
    
  3. Send an event using AppMetrica.reportEvent to test the operation:

    AppMetrica.reportEvent('My first AppMetrica event!');
    

Learn more

If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.

Contact support