lemnisk_plugin 0.0.7 copy "lemnisk_plugin: ^0.0.7" to clipboard
lemnisk_plugin: ^0.0.7 copied to clipboard

outdated

The Lemnisk Flutter SDK allows you to track user event data from your Android app. The SDK can be easily imported into any Android or iOS app. Based on the data it receives from the user activity, it [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:lemnisk_plugin/AttributeBuilder.dart';
import 'package:lemnisk_plugin/LemniskFlutterCore.dart';
import 'package:lemnisk_plugin/LemniskHelper.dart';

void main() {
  //lemnisk server requirements
  String SERVER_URL = "xyz";
  String WRITE_KEY = "xyz";

  //firebase analytics requirements
  LemniskFirebaseCore lemniskFirebaseCore = LemniskFirebaseCore(
    projectName: "xxx",
    enable: false,
    appId: "xxx",
    apiKey: "xxx",
    projectId: "xxx",
    messagingSenderId: "xxx",
  );

  //apps flyer requirements
  LemniskApsflyerCore lemniskApsflyer = LemniskApsflyerCore(
    enable: false,
    afAppId: "xxx",
    afDevKey: "xxx",
  );

  LemniskHelper.configure(SERVER_URL, WRITE_KEY, lemniskFirebaseCore, lemniskApsflyer);

  runApp(const MyApp());
}

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

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  void getIdentify() {
    AttributeBuilder attributeBuilder = AttributeBuilder();
    attributeBuilder.properties['key1'] = 'value1';
    attributeBuilder.properties['key2'] = 'value2';

    OtherBuilder otherBuilder = OtherBuilder();
    otherBuilder.otherid['otherId'] = 'otherId_value';

    LemniskHelper.identify("user_id", attributeBuilder, otherBuilder);
  }

  void getScreen() {
    AttributeBuilder attributeBuilder = AttributeBuilder();
    attributeBuilder.properties['key1'] = 'value1';
    attributeBuilder.properties['key2'] = 'value2';

    OtherBuilder otherBuilder = OtherBuilder();
    otherBuilder.otherid['otherId'] = 'otherId_value';

    LemniskHelper.screen("MainActivity", attributeBuilder, otherBuilder);
  }

  void getTrack() {
    AttributeBuilder attributeBuilder = AttributeBuilder();
    attributeBuilder.properties['properties'] = 'material';
    attributeBuilder.properties['button'] = 'Track event from different app';

    OtherBuilder otherBuilder = OtherBuilder();
    otherBuilder.otherid['trackerId'] = '6791c47a-0178-47bc-8711-86a2c67b2255';

    LemniskHelper.track("MainDartFile", attributeBuilder, otherBuilder);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Lemnisk Flutter SDK'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              ElevatedButton(
                child: Text('Track'),
                onPressed: () {
                  getTrack();
                },
                style: ElevatedButton.styleFrom(
                  primary: Colors.blue,
                  padding: EdgeInsets.symmetric(horizontal: 35, vertical: 10),
                  textStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
                ),
              ),
              SizedBox(
                height: 20,
              ),
              ElevatedButton(
                child: Text('Screen'),
                onPressed: () {
                  getScreen();
                },
                style: ElevatedButton.styleFrom(
                  primary: Colors.blue,
                  padding: EdgeInsets.symmetric(horizontal: 30, vertical: 10),
                  textStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
                ),
              ),
              SizedBox(
                height: 20,
              ),
              ElevatedButton(
                child: Text('Identify'),
                onPressed: () {
                  getIdentify();
                },
                style: ElevatedButton.styleFrom(
                  primary: Colors.blue,
                  padding: EdgeInsets.symmetric(horizontal: 30, vertical: 10),
                  textStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
17
likes
0
pub points
0%
popularity

Publisher

verified publisherlemnisk.co

The Lemnisk Flutter SDK allows you to track user event data from your Android app. The SDK can be easily imported into any Android or iOS app. Based on the data it receives from the user activity, it sends real-time personalized push notifications to the users about the services and products that our clients provide.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

advertising_id, appsflyer_sdk, date_time_format, device_info, firebase_analytics, firebase_core, flutter, flutter_web_plugins, http, intl, package_info_plus, platform_device_id_platform_interface, uuid

More

Packages that depend on lemnisk_plugin