ei_sdk_plugin 0.0.1 copy "ei_sdk_plugin: ^0.0.1" to clipboard
ei_sdk_plugin: ^0.0.1 copied to clipboard

Flutter plugin package to track install and other events in android and ios.

example/lib/main.dart

import 'dart:math';

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

import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';

import 'package:flutter/services.dart';
import 'package:ei_sdk_plugin/ei_sdk_plugin.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  final _eiSdkPlugin = EiSdkPlugin();

  @override
  void initState() {
    super.initState();
    WidgetsFlutterBinding.ensureInitialized();
    initFirebase();
    runApp(const MyApp());
    initPlatformState();
  }

  Future<void> initFirebase() async{
    FirebaseOptions options_ = DefaultFirebaseOptions.currentPlatform;

    print("options");
    print(options_);

    await Firebase.initializeApp(
      options: options_,
    );

    print("firebase done");
    // await Future.delayed(Duration(seconds: 3));
    await _eiSdkPlugin.eiInit(
      eikey: "df181c946db615f8",
      userId: 'user_1234',
      debugKey: "6448effa8c",
    );
    // await Future.delayed(Duration(seconds: 3));
    await _eiSdkPlugin.start(
      fbAppId: 'fb_app_id',
      debug: true, // Use test webhook
    );
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {

    await _eiSdkPlugin.logEvent(
      eventName: 'purchase',
      userId: 'user_123',
      payload: {
        'product_id': 'prod_123',
        'amount': 99.99,
        'currency': 'USD',
      },
      debug: true, // Use production endpoint
    );
  }

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

Publisher

unverified uploader

Weekly Downloads

Flutter plugin package to track install and other events in android and ios.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on ei_sdk_plugin

Packages that implement ei_sdk_plugin