Skip to content

Instantly share code, notes, and snippets.

@jacobaraujo7
Created January 2, 2021 18:36
Show Gist options
  • Save jacobaraujo7/b0e851170d76b385b57f4779dccd62d2 to your computer and use it in GitHub Desktop.
Save jacobaraujo7/b0e851170d76b385b57f4779dccd62d2 to your computer and use it in GitHub Desktop.
class HomePage extends StatelessWidget {
final counter = RxNotifier<int>(0);
_increment() => counter.value++;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Counter')),
body: Center(
child: RxBuilder(
builder: (_) {
return Text('${counter.value}');
}
),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.plus_one),
onPressed: _increment,
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment