batch_flutter 1.0.0-rc.2 copy "batch_flutter: ^1.0.0-rc.2" to clipboard
batch_flutter: ^1.0.0-rc.2 copied to clipboard

outdated

Batch.com Flutter Plugin. Batch Flutter Plugin allows you to build meaningful communication experience in your iOS 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';
import 'plugin_test_menu.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
0
points
5.15k
downloads

Publisher

verified publisherbatch.com

Weekly Downloads

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

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on batch_flutter