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
    Copied to clipboard

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

    dependencies:
        appmetrica_plugin: ^1.3.0
    Copied to clipboard
  2. Add appmetrica_plugin import:
    import 'package:appmetrica_plugin/appmetrica_plugin.dart';
    Copied to clipboard
  3. Initialize the AppMetrica library using AppMetrica.activate and your API key:

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

    AppMetrica.reportEvent('My first AppMetrica event!');
    Copied to clipboard

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.