diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/data.dart | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/data.dart b/lib/data.dart index 4091bb3..93c523d 100644 --- a/lib/data.dart +++ b/lib/data.dart @@ -3,35 +3,35 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; class AppState with ChangeNotifier { - List<Contact> contacts = <Contact>[ - Contact(address: "Living Room Window", isOpen: false), - Contact(address: "Front Door", isOpen: true), - Contact(address: "Back Door", isOpen: false), - Contact(address: "Garage Window", isOpen: true), - ]; + List<Contact> contacts = <Contact>[ + Contact(address: "Living Room Window", isOpen: false), + Contact(address: "Front Door", isOpen: true), + Contact(address: "Back Door", isOpen: false), + Contact(address: "Garage Window", isOpen: true), + ]; - Timer? _timer; + Timer? _timer; - AppState() { - _timer = Timer.periodic(const Duration(seconds: 1), (_) { - toggleFirstContact(); - }); - } - - void toggleFirstContact() { - if (contacts.isEmpty) { - return; - } + AppState() { + _timer = Timer.periodic(const Duration(seconds: 1), (_) { + toggleFirstContact(); + }); + } - contacts[0].isOpen = !contacts[0].isOpen; - notifyListeners(); + void toggleFirstContact() { + if (contacts.isEmpty) { + return; } - @override - void dispose() { - _timer?.cancel(); - super.dispose(); - } + contacts[0].isOpen = !contacts[0].isOpen; + notifyListeners(); + } + + @override + void dispose() { + _timer?.cancel(); + super.dispose(); + } } class Contact { |
