mixpanel_flutter 2.5.0 copy "mixpanel_flutter: ^2.5.0" to clipboard
mixpanel_flutter: ^2.5.0 copied to clipboard

Official Flutter Tracking SDK for Mixpanel Analytics developed and maintained by Mixpanel, Inc.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:mixpanel_flutter_example/widget.dart';

import 'event.dart';
import 'feature_flags.dart';
import 'gdpr.dart';
import 'group.dart';
import 'profile.dart';

// This is the main page only, check out the example app in https://github.com/mixpanel/mixpanel-flutter/tree/main/example
void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp();

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      initialRoute: '/',
      routes: {
        '/': (context) => FirstScreen(),
        '/event': (context) => EventScreen(),
        '/profile': (context) => ProfileScreen(),
        '/gdpr': (context) => GDPRScreen(),
        '/group': (context) => GroupScreen(),
        '/feature_flags': (context) => FeatureFlagsScreen(),
      },
    );
  }
}

class FirstScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Color(0xff4f44e0),
        title: Text('Mixpanel Demo'),
      ),
      body: Center(
          child: Column(
        children: [
          SizedBox(
            height: 40,
          ),
          SizedBox(
            width: MediaQuery.of(context).size.width * 0.65,
            child: MixpanelButton(
              text: 'EVENT',
              onPressed: () {
                Navigator.pushNamed(context, '/event');
              },
            ),
          ),
          SizedBox(
            height: 20,
          ),
          SizedBox(
            width: MediaQuery.of(context).size.width * 0.65,
            child: MixpanelButton(
              text: 'PROFILE',
              onPressed: () {
                Navigator.pushNamed(context, '/profile');
              },
            ),
          ),
          SizedBox(
            height: 20,
          ),
          SizedBox(
            width: MediaQuery.of(context).size.width * 0.65,
            child: MixpanelButton(
              text: 'GDPR',
              onPressed: () {
                Navigator.pushNamed(context, '/gdpr');
              },
            ),
          ),
          SizedBox(
            height: 20,
          ),
          SizedBox(
            width: MediaQuery.of(context).size.width * 0.65,
            child: MixpanelButton(
              text: 'GROUP',
              onPressed: () {
                Navigator.pushNamed(context, '/group');
              },
            ),
          ),
          SizedBox(
            height: 20,
          ),
          SizedBox(
            width: MediaQuery.of(context).size.width * 0.65,
            child: MixpanelButton(
              text: 'FEATURE FLAGS',
              onPressed: () {
                Navigator.pushNamed(context, '/feature_flags');
              },
            ),
          ),
        ],
      )),
    );
  }
}
144
likes
140
points
209k
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Official Flutter Tracking SDK for Mixpanel Analytics developed and maintained by Mixpanel, Inc.

Homepage
Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on mixpanel_flutter

Packages that implement mixpanel_flutter