Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
counter_page.dart
class CounterPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Counter')),
body: BlocBuilder<CounterCubit, int>(
builder: (context, count) => Center(child: Text('$count')),
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () => context.bloc<CounterCubit>().increment(),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment