amplitude_flutter 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 92

amplitude_flutter #

The Official Amplitude Flutter plugin. Used to track events with Amplitude.

Getting Started #

To use this plugin, add amplitude_flutter as a dependency in your pubspec.yaml file.

Find the API key for your Amplitude project under your project settings.

Import package:amplitude_flutter/amplitude_flutter.dart, and instantiate AmplitudeFlutter with your API key.

In addition, a Config object can be passed as a constructor argument for additional options.

NOTE: This plugin's methods should only be called from the main isolate.

Example #

import 'package:amplitude_flutter/amplitude_flutter.dart';

Future<void> example() async {
  final AmplitudeFlutter analytics =  AmplitudeFlutter('API KEY');

  // set this user's id

  // log an event
  analytics.logEvent(name: 'add_friend');

  // Log events with properties
  analytics.logEvent(name: 'add_friend', properties: { 'key': 'value' });

  // identify a user
  final Identify identify = Identify()
    ..set('cohort', 'Test A')
    ..setOnce('completed_onboarding', 'true')
    ..add('login_count', 1)
    ..append('tags', 'new tag')


  // Amplitude Accounts [] methods:
  // add a user to a group
  analytics.setGroup('orgId', 15);

  // change properties of a group
  analytics.groupIdentify('orgId', 15, Identify()..set('account_manager', 456));

  // emit an event associated with a group
  analytics.logEvent('Demo Released', properties: { 'groups': { 'orgId': 15 } });

  // Log revenue
  final Revenue revenue = Revenue()


1.0.1 #

  • Wait for device info to be available before sending events

1.0.0 #

  • Send event_id with payloads
  • Add application version to events
  • Limit stored events

0.2.0 #

  • Add setUserId()
  • Add a sequence_id sent with events
  • Config option to opt out of tracking
  • Example app changes

0.1.0 #

  • Adds revenue tracking.
  • Catch errors from platform channels.

0.0.2 #

  • Fixes bug where default session timeout was not set.
  • Persist events to sqlite database.
  • Refactor to use service provider class to simplify dependency injection in test.
  • Add group identify functionality.
  • Retry posting events.
  • Flush event buffer every 30s.
  • Retry posting events when payload is too large.
  • Include uuid for events.
  • Include library version for events.

0.0.1+1 #

  • Fixes serialization bug preventing events from sending.

0.0.1 #

  • Implements logEvent and identify functionality.


amplitude_flutter_example #

Demonstrates how to use the amplitude_flutter plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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

  amplitude_flutter: ^1.0.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:amplitude_flutter/amplitude_flutter.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 Nov 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
crypto ^2.0.6 2.1.3
device_info ^0.4.0+1 0.4.1+1
flutter 0.0.0
http ^0.12.0+2 0.12.0+2
package_info ^0.4.0+3 0.4.0+10
sqflite ^1.1.5 1.1.7+2
uuid ^2.0.1 2.0.2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
convert 2.1.1
http_parser 3.1.3
meta 1.1.7 1.1.8
path 1.6.4
pedantic 1.8.0+1
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
synchronized 2.1.0+1
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
mockito 4.0.0