engage_plugin 1.0.3 copy "engage_plugin: ^1.0.3" to clipboard
engage_plugin: ^1.0.3 copied to clipboard

outdated

A flutter plugin for the engage SDK's

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:engage_plugin/engage_plugin.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> {
  final _engagePlugin = EngagePlugin();

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

  var initConfig = InitConfig("user",
      "8ec825f7f1f65bbcc38badb1c8cdc5c0365e7e14a494f1f24569620c2533b926");
  var tagUserInfo = TagUserInfo(
      ["Client", "Marketing"], "JohnDoe@engage.com", "John", "Doe", "testID");

  Future<void> initPlatformState() async {
    try {
      await _engagePlugin.init(initConfig);
    } on PlatformException {
      'failed to init engage';
    }

    if (!mounted) {
      return;
    }

    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Engage plugin example'),
        ),
        body: Center(
            child: Column(
          children: [
            ElevatedButton(
                onPressed: (() => _engagePlugin.init(initConfig)),
                child: const Text('Init Plugin')),
            ElevatedButton(
                onPressed: () => _engagePlugin.openChat(),
                child: const Text('Open Chat')),
            ElevatedButton(
                onPressed: () => _engagePlugin.startCoBrowsing(),
                child: const Text('Open coBrowser')),
            ElevatedButton(
                onPressed: () => _engagePlugin.stopCoBrowsing(),
                child: const Text('Stop coBrowser')),
            ElevatedButton(
                onPressed: () => _engagePlugin.tagUser(tagUserInfo),
                child: const Text('Tag user')),
            ElevatedButton(
                onPressed: () => _engagePlugin.clear(),
                child: const Text('Clear')),
          ],
        )),
      ),
    );
  }
}
1
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A flutter plugin for the engage SDK's

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on engage_plugin