customer_io 0.0.1-alpha.3 copy "customer_io: ^0.0.1-alpha.3" to clipboard
customer_io: ^0.0.1-alpha.3 copied to clipboard

outdated

A plugin for Customer.io

example/lib/main.dart

import 'dart:async';

import 'package:customer_io/customer_io.dart';
import 'package:customer_io/customer_io_config.dart';
import 'package:flutter/material.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await CustomerIo.initialize(
    config: CustomerIOConfig(
      siteId: "YOUR_SITE_ID",
      apiKey: "YOUR_API_KEY",
    ),
  );

  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';

  @override
  void initState() {
    super.initState();
    initPlatformState();
    CustomerIo.identify(
        identifier: "and-flut-wow",
        attributes: {"name": "yolo", "age": 10, "weight": 33.3});
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    // 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 = "Platform";
    });
  }

  @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'),
        ),
      ),
    );
  }
}
12
likes
0
points
25.1k
downloads

Publisher

unverified uploader

Weekly Downloads

A plugin for Customer.io

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on customer_io