plotline 1.2.5 copy "plotline: ^1.2.5" to clipboard
plotline: ^1.2.5 copied to clipboard

outdated

This is the official flutter plugin for Plotline's Android SDK.

example/lib/main.dart

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

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  final _plotlinePlugin = Plotline();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plotline Plugin Test App'),
        ),
        body: Center(child: Column(children: <Widget> [
          Container(
            margin: EdgeInsets.all(25),
            child: Text('Running on: $_platformVersion\n'),
          ),
          Container(
            margin: EdgeInsets.all(25),
            child: FlatButton(
              child: Text('Show Mock Study', style: TextStyle(fontSize: 20.0),),
              color: Colors.blueAccent,
              textColor: Colors.white,
              onPressed: _showMockStudy,
            ),
          ),
          Container(
            margin: EdgeInsets.all(25),
            child: FlatButton(
              child: Text('Init', style: TextStyle(fontSize: 20.0),),
              color: Colors.blueAccent,
              textColor: Colors.white,
              onPressed: _init,
            ),
          ),
          Container(
            margin: EdgeInsets.all(25),
            child: FlatButton(
              child: Text('Trigger #1', style: TextStyle(fontSize: 20.0),),
              color: Colors.blueAccent,
              textColor: Colors.white,
              onPressed: _track,
            ),
          ),
          Container(
            margin: EdgeInsets.all(25),
            child: FlatButton(
              child: Text('Identify', style: TextStyle(fontSize: 20.0),),
              color: Colors.blueAccent,
              textColor: Colors.white,
              onPressed: _identify,
            ),
          ),
          Container(
            margin: EdgeInsets.all(25),
            child: FlatButton(
              child: Text('Composite Trigger', style: TextStyle(fontSize: 20.0),),
              color: Colors.blueAccent,
              textColor: Colors.white,
              onPressed: _compositeTrack,
            ),
          ),
        ]))
      ),
    );
  }

  _init() {
    print('Init started');
    Plotline.init("<apiKey>", "<userId>");
  }

  _showMockStudy() {
    print('Showing Mock study');
    Plotline.showMockStudy();
  }

  _track() {
    print('Tracking Event');
    Plotline.track("<eventName>");
  }

  _identify() {
    print('Identify attribute');
    Plotline.identify({
        "key": "value"
    });
  }

  _compositeTrack() {
      print('Tracking Composite Event');
      Plotline.track("<Main Code Event>", properties: {"key": "value"});
  }
}
4
likes
0
points
88
downloads

Publisher

unverified uploader

Weekly Downloads

This is the official flutter plugin for Plotline's Android SDK.

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on plotline

Packages that implement plotline