Created
September 6, 2022 14:10
-
-
Save AseemWangoo/ffe7f19a820cb6dcb269ac3d44e037cb to your computer and use it in GitHub Desktop.
Sample change notifier
This file contains 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 Person extends ChangeNotifier { | |
Person({this.name, this.age}); | |
final String name; | |
int age; | |
void increaseAge() { | |
this.age++; | |
notifyListeners(); | |
} | |
} | |
void main() { | |
runApp( | |
ChangeNotifierProvider( | |
create: (_) => Person(name: "Joe", age: 28), | |
child: MyApp(), | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment