import 'package:mock/person.dart'; import 'package:mock/business.dart'; import 'package:mock/person_data_access_map.dart'; import 'package:mock/person_data_access_sqlite.dart'; /* @startuml class Business { - PersonDataAccessMap backend } PersonDataAccessMap <-left- Business : uses class PersonDataAccessMap { - Map map + store(Person p): void + retrieve(int id): Person + retrieveAll(): List } class PersonDataAccessSqlite implements PersonDataAccessMap { - Sqlite db + store(Person p): void + retrieve(int id): Person + retrieveAll(): List } @enduml */ void main() { PersonDataAccessMap backend = PersonDataAccessSqlite("sqlite3.db"); Business b = Business(backend); List persons = b.getAllPersons(); int personCount = persons.length; print("We know $personCount persons"); int nextPersonId = ++personCount; b.addPerson(Person(nextPersonId, "A New Person")); print("Now we know ${b.getAllPersons().length} persons"); backend.close(); }