segment_flutter_sdk 1.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

segment_flutter_sdk #

pub package

A Flutter plugin that allows sending analytics events to

Installation #

Just add the dependency on your pubspec.yaml file

How to use it? #

You need to initialize Segment tracker at application startup.

Future<void> main() async {
  final segmentTracker = await FlutterSegmentSdk.init(writeKey: "YOUR WRITE KEY HERE", logLevel: LogLevel.VERBOSE);

Note: There are other parameters available that allows you to customize how Segment SDK works. These are all the init method allowed parameters, being writeKey the only required one.

static Future<FlutterSegmentSdk> init({
    @required String writeKey,
    bool collectDeviceId,
    int flushQueueSize,
    String tag,
    LogLevel logLevel,
    bool trackApplicationLifecycleEvents,
    bool recordScreenViews,
    bool trackAttributionInformation,
    bool useFirebaseAnalytics,

Track a screen #

You can log screens and add custom properties to the screen log event.

Future<void> trackScreen({@required String name, Map<String, dynamic> properties})

Track event #

You can also track events, api is similar as the one used for screens.

Future<void> trackEvent({@required String name, Map<String, dynamic> properties})

Identify a user #

Segment allows you to identify customers, this SDK does so by using this method:

Future<void> identify({@required String userId})

Example #

Checking example app will help you understanding how to initialise and use the SDK.

1.1.1 #

Upgrade android build gradle compileSdkVersion to 28 Upgrade example app to Android X and compileSdkVersion 28 Migrate to Android X

1.1.0 #

Allow adding traits when identifying users

1.0.0+1 #

Initial release of the SDK


segment_flutter_sdk_example #

Demonstrates how to use the segment_flutter_sdk 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:

  segment_flutter_sdk: ^1.1.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:segment_flutter_sdk/segment_flutter_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 Jan 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
meta ^1.1.7 1.1.8
Transitive dependencies
collection 1.14.11 1.14.12
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8