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.3.0
Step 2. Initialize the library
-
Add
appmetrica_pluginimport:import 'package:appmetrica_plugin/appmetrica_plugin.dart'; -
Initialize the AppMetrica library using
AppMetrica.activateand your API key:AppMetrica.activate(AppMetricaConfig("insert_your_api_key_here")); -
Send an event using
AppMetrica.reportEventto 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.