Installation and initialization

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

  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
    
  2. Add appmetrica_plugin import:

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

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

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

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