batch_flutter 2.0.0 copy "batch_flutter: ^2.0.0" to clipboard
batch_flutter: ^2.0.0 copied to clipboard

Batch SDK Flutter Plugin allows you to build meaningful communication experiences in your app through highly personalized push notifications and In-App messages.

example/lib/main.dart

import 'package:batch_flutter/batch_push.dart';
import 'package:batch_flutter_example/batch_store/data/model/subscriptions.dart';
import 'package:batch_flutter_example/batch_store/root_tab_page.dart';
import 'package:flutter/material.dart';

import 'package:provider/provider.dart';

import 'batch_store/data/model/app_state_model.dart';
import 'batch_store/data/model/cart.dart';

void main() {
  runApp(MultiProvider(
    providers: [
      ChangeNotifierProvider<BatchStoreAppStateModel>(
        create: (_) => BatchStoreAppStateModel()..loadModel(),
      ),
      ChangeNotifierProvider<CartModel>(
        create: (_) => CartModel()..loadModel(),
      ),
      ChangeNotifierProvider<SubscriptionsModel>(
        create: (_) => SubscriptionsModel()..loadModel(),
      )
    ],
    child: BatchExampleApp(),
  ));
}

class BatchExampleApp extends StatefulWidget {
  @override
  _BatchExampleAppState createState() => _BatchExampleAppState();
}

class _BatchExampleAppState extends State<BatchExampleApp> {
  @override
  void initState() {
    super.initState();

    // Warm up the subscriptions by loading the subscriptions model.
    Provider.of<SubscriptionsModel>(context, listen: false)
        .writeDefaultValues();

    BatchPush.instance.setShowForegroundNotificationsOniOS(true);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: RootTabPage(),
    );
  }
}
10
likes
150
points
7.12k
downloads

Publisher

verified publisherbatch.com

Weekly Downloads

Batch SDK Flutter Plugin allows you to build meaningful communication experiences in your app through highly personalized push notifications and In-App messages.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on batch_flutter