klaviyo_flutter 0.0.1+2 copy "klaviyo_flutter: ^0.0.1+2" to clipboard
klaviyo_flutter: ^0.0.1+2 copied to clipboard

Flutter plugin for Klaviyo integration. Provides push messaging and Klaviyo analitics services

example/lib/main.dart

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

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

  /// make sure to add keys from your Klaviyo workspace.
  await Klaviyo.instance.initialize(
    'appId',
  );
  runApp(SampleApp());
}

class SampleApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Klaviyo example app'),
        ),
        body: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            TextButton(
              onPressed: () async {
                await Klaviyo.instance.logEvent(
                  '\$successful_payment',
                  {'\$value': 'paymentValue'},
                );
              },
              child: Text('Send Klaviyo SUCCESSFUL_PAYMENT event'),
            ),
            TextButton(
              onPressed: () async {
                final result = await Klaviyo.instance
                    .handlePush({'_k': '', 'body': 'Hey'});
                print('result:$result');
              },
              child: Text('Handle Klaviyo push'),
            )
          ],
        ),
      ),
    );
  }
}
8
likes
0
points
3.49k
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for Klaviyo integration. Provides push messaging and Klaviyo analitics services

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

equatable, flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on klaviyo_flutter