pendo_flutter_plugin 1.0.0 pendo_flutter_plugin: ^1.0.0 copied to clipboard
Pendo Flutter plugin
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:pendo_flutter_plugin/pendo_flutter_plugin.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
dynamic arguments = {};
PendoFlutterPlugin.initSDK("eyJhbGciOiJSUzI1NiIsImtpZCI6IiIsInR5cCI6IkpXVCJ9.eyJkYXRhY2VudGVyIjoidXMiLCJrZXkiOiI3NGE5MTc0N2Q5OTE4N2Q3MjRhMWY4ZGU3MjliYTUxMGY5ZGY5Nzk5MDE5MmM2MWM2ZWEyNTc4N2IyZWJlMTg5ODUyMmQ0NWVjODY5NDZmODA1YjY3OTIwZGQwZDk3NDIwY2NkYTFkMjNhOTBiYWIwNGQ5OTgzNGRlOWI2OTkyMjliZDE5YTM1MTU3MjhlM2ZhM2UxNDFjNmFiZGNkNjllLmJhZjFhYzRjNGNlMDVmNjAzZDg4YTY1MmNkZGNjMjJmLmYxNzRhMzljNzRkNmJkZDBhZTUxZTQxZTEyYjBiMWYyMGQxODA1OGI4ODIwMjFjNmM2MWUxZjdhNWMwZTYwNWYifQ.RO6yJ36FtEt6DcjSLZEyvZ4m1w_VkNe0edfTDP0Ttt7WsVQ9JGHMnQXq4_2mvQW1QWfvowK0AJSBQBDs9QPRBM5V5hU__UYE72p2AYeOeywGHveXf9LWKd2sodK-AUyMEujWTv3IuIC4oi2nMMxCIFJ4nuuMPhAFWY5cY9wYQIQ", arguments );
PendoFlutterPlugin.clearVisitor();
PendoFlutterPlugin.switchVisitor("visitorId","accountId", arguments, arguments);
PendoFlutterPlugin.setVisitorData(arguments);
PendoFlutterPlugin.setAccountData(arguments);
PendoFlutterPlugin.trackEventWithProperties("event",arguments);
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_platformVersion = platformVersion;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on: $_platformVersion\n'),
),
),
);
}
}