mbaudience 2.1.2+1 copy "mbaudience: ^2.1.2+1" to clipboard
mbaudience: ^2.1.2+1 copied to clipboard

MBAudience is a plugin libary for MBurger, that lets you track user data and behavior inside your and to target messages only to specific users or groups of users.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:mbaudience/mbaudience.dart';
import 'package:mburger/mburger.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> {
  @override
  void initState() {
    MBManager.shared.apiToken = 'YOUR_API_TOKEN';
    MBManager.shared.plugins = [MBAudience()];

    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('MBAudience example app'),
        ),
        body: Center(
          child: Column(
            children: [
              Padding(
                padding: const EdgeInsets.all(8.0),
                child: TextButton(
                  onPressed: () => _setTag(),
                  child: const Text('Set tag'),
                ),
              ),
              Padding(
                padding: const EdgeInsets.all(8.0),
                child: TextButton(
                  onPressed: () => _setCustomId(),
                  child: const Text('Set custom id'),
                ),
              ),
              Padding(
                padding: const EdgeInsets.all(8.0),
                child: TextButton(
                  onPressed: () => _startLocationUpdates(),
                  child: const Text('Start location updates'),
                ),
              ),
              Padding(
                padding: const EdgeInsets.all(8.0),
                child: TextButton(
                  onPressed: () => _stopLocationUpdates(),
                  child: const Text('Stop location updates'),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  void _setTag() {
    MBAudience.setTag(tag: 'Tag', value: 'Value');
  }

  void _setCustomId() {
    MBAudience.setCustomId('CUSTOM_ID');
  }

  void _startLocationUpdates() {
    MBAudience.startLocationUpdates();
  }

  void _stopLocationUpdates() {
    MBAudience.stopLocationUpdates();
  }
}
6
likes
160
pub points
23%
popularity

Publisher

verified publishermburger.cloud

MBAudience is a plugin libary for MBurger, that lets you track user data and behavior inside your and to target messages only to specific users or groups of users.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, mburger, package_info_plus, permission_handler, shared_preferences

More

Packages that depend on mbaudience