segment_flutter_sdk 1.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

segment_flutter_sdk #

pub package

A Flutter plugin that allows sending analytics events to https://segment.com

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);
  runApp(MyApp(segmentTracker));
}

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.0 #

Allow adding traits when identifying users

1.0.0+1 #

Initial release of the SDK

example/README.md

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:


dependencies:
  segment_flutter_sdk: ^1.1.0

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';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
44
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on Dec 4, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

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

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

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.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