Created
February 14, 2021 08:39
-
-
Save felixblaschke/8208090fdb82550adde752a74ae5b886 to your computer and use it in GitHub Desktop.
riverpod4.dart
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
var aNumber = StateProvider((_) => 0); | |
class SomeButton extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return ElevatedButton( | |
child: Text("Click me"), | |
onPressed: () => buttonClicked(context), | |
); | |
} | |
buttonClicked(BuildContext context) { | |
context.read(aNumber).state = 42; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment