lemnisk_plugin 0.0.3 lemnisk_plugin: ^0.0.3 copied to clipboard
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 [...]
import 'package:flutter/material.dart';
import 'package:lemnisk_plugin/AttributeBuilder.dart';
import 'package:lemnisk_plugin/LemniskHelper.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> {
@override
void initState() {
super.initState();
getIdentify();
getScreen();
getTracking();
}
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 getTracking() {
AttributeBuilder attributeBuilder = AttributeBuilder();
attributeBuilder.properties['key1'] = 'value1';
attributeBuilder.properties['key2'] = 'value2';
OtherBuilder otherBuilder = OtherBuilder();
otherBuilder.otherid['otherId'] = 'otherId_value';
LemniskHelper.track("Product Added", attributeBuilder, otherBuilder);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Lemnisk Flutter SDK'),
),
body: Center(
child: Text('Hello World'),
),
),
);
}
}