Skip to content

Instantly share code, notes, and snippets.

@AseemWangoo
Created September 6, 2022 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AseemWangoo/ffe7f19a820cb6dcb269ac3d44e037cb to your computer and use it in GitHub Desktop.
Save AseemWangoo/ffe7f19a820cb6dcb269ac3d44e037cb to your computer and use it in GitHub Desktop.
Sample change notifier
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