Created
January 2, 2021 18:36
-
-
Save jacobaraujo7/b0e851170d76b385b57f4779dccd62d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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