Count and save in a variable the number of beers that I drank. The number increase when I press a buttom and save data in a .txt, this .txt is loaded each time you open the app
int _count = 0; File file = File("myBeers.txt"); void addBeers(int count) { _count = count; file.writeAsString(count.toString()); } void loadBeers() async { if (await file.exists()) { _count = int.parse(await file.readAsString()); } }