Skip to content

Instantly share code, notes, and snippets.

@junjizhi
Created July 13, 2019 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junjizhi/e1cc6afbd0fdbc9f7a43609920c96295 to your computer and use it in GitHub Desktop.
Save junjizhi/e1cc6afbd0fdbc9f7a43609920c96295 to your computer and use it in GitHub Desktop.
Flutter BLoC and Provider: A Shopping Cart Example - Hooking up Bloc with the app
// https://github.com/junjizhi/flutter-shopping-cart
import 'cart_bloc.dart';
import 'package:provider/provider.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider<CartBloc>(
builder: (context) => CartBloc(),
child: MaterialApp(
title: 'Flutter Shopping Cart Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Gift Shop'),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment