import 'package:flutter/foundation.dart'; class Person { String name; int age; Person(this.name, this.age); } class MyProvider with ChangeNotifier { final List _people = [ Person('John', 30), Person('Jane', 25), Person('Jack', 20), Person('Chea', 40), ]; List get people => _people; void addPerson(Person person) { _people.add(person); notifyListeners(); } void removePerson(Person person) { _people.remove(person); notifyListeners(); } void removeLastPerson() { _people.removeLast(); notifyListeners(); } }