appmetrica_sdk 0.0.5+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 87

appmetrica_sdk #

pub package CircleCI

A Flutter plugin for Yandex AppMetrica SDK.

Plugin implementation status #

Implemented #

Not implemented yet #

Usage #

To use this plugin, add appmetrica_sdk as a dependency in your pubspec.yaml file. See demonstration how to use the appmetrica_sdk plugin in example section.

Documentation #

Common documentation available on AppMetrica official site.

Bugs or Requests #

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on GitHub and we'll look into it. Pull request are also welcome.

0.0.5+1 #

  • Upgrade AppMetrica SDK (Android 3.10.0/iOS 3.9.4).

0.0.5 #

  • Add reportReferralUrl function (#5) via kirill09. Sets referral URL for app installs.
  • Upgrade AppMetrica SDK for iOS (3.9.2).

0.0.4+4 #

  • Plugin polishing.

0.0.4+3 #

  • Remove the deprecated author: field from pubspec.yaml.
  • Fix example app by adding a call to ensureInitialized.
  • Update example code. Plugin documentation polishing. added.

0.0.4+2 #

  • Upgrade AppMetrica SDK for Android (3.8.0).

0.0.4+1 #

  • Upgrade AppMetrica SDK for iOS (3.8.2). Fixed an issue #2 with "helper" command line tool in dynamic frameworks.

0.0.4 #

  • Upgrade AppMetrica SDK (Android 3.7.2/iOS 3.8.0).
  • Add sendEventsBuffer function. Sends stored events from the buffer.
  • Android only. Add maxReportsInDatabaseCount activation parameter - maximum number of events that can be stored in the database on the phone before being sent to AppMetrica.

0.0.3 #

  • Add setUserProfileID function (required for predefined profile attributes).
  • Update example code.
  • Upgrade dependencies.

0.0.2+1 #

  • iOS polishing.
  • Update readme.

0.0.2 #

  • Add crash reporting flag.
  • Cleanup.

0.0.1 #

  • Initial release. Based on C++ version of Appmetrica SDK integration for Cocos2d-x.


import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:appmetrica_sdk/appmetrica_sdk.dart';

void main() async {

  /// Initializing the AppMetrica SDK.
  await AppmetricaSdk()
      .activate(apiKey: 'db2206ed-c61a-43aa-b95c-6912f60bd25e');


class MyApp extends StatefulWidget {
  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  String _libraryVersion = 'Unknown';

  void initState() {

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initLibrarayVersionState() async {
    String libraryVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      libraryVersion = await AppmetricaSdk().getLibraryVersion();
    } on PlatformException {
      libraryVersion = 'Failed to get library version.';

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) {

    setState(() {
      _libraryVersion = libraryVersion;

  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(
              title: const Text('Plugin example app'),
            body: Container(
              padding: const EdgeInsets.all(8),
              child: Center(
                child: Column(
                  children: <Widget>[
                      child: Text(
                          'AppMetrica SDK Library version: $_libraryVersion\n'),
                      child: const Text('Send a custom event'),
                      onPressed: () {
                        /// Sending a custom event without nested parameters.
                        AppmetricaSdk().reportEvent(name: 'Updates installed');
                      child: const Text(
                          'Send a custom event with nested parameters'),
                      onPressed: () {
                        /// Sending a custom event with nested parameters.
                            name: 'Current app statistics',
                            attributes: <String, dynamic>{
                              'Application': '',
                              'Audience': 1000000000,
                              'Product price in €': 10000000.99,
                              'nested map': <String, dynamic>{
                                'strategies': 'Age of Empires',
                      child: const Text('Send user profile attributes'),
                      onPressed: () {
                        /// Sending profile custom string attribute.
                            key: 'string_attribute', value: 'string');

                        /// Sending profile custom number attribute.
                            key: 'number_attribute', value: 55);

                        /// Sending profile custom boolean attribute.
                            key: 'boolean_attribute', value: true);

                        /// Sending profile custom attribute of the counter type.
                            key: 'counter_attribute', delta: 1);

                        /// Sets the ID of the user profile. Required for predefined
                        /// profile attributes like Name or Notifications enabled.
                        AppmetricaSdk().setUserProfileID(userProfileID: 'id');

                        /// Sending profile predefined user name attribute.
                            .reportUserProfileUserName(userName: 'John');

                        /// Sending profile predefined NotificationsEnabled attribute.
                            notificationsEnabled: true);
                      child: const Text(
                          'Send referral URL for this installation'),
                      onPressed: () {
                        /// Sets referral URL for this installation. This might
                        /// be required to track some specific traffic
                        /// sources like Facebook.
                          referral: 'fb123456789://',

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  appmetrica_sdk: ^0.0.5+1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:appmetrica_sdk/appmetrica_sdk.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies