This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/widgets.dart'; | |
/// Helper class to manage the state of a page/widget. </br> | |
class PageStateNotifier<Error> extends ChangeNotifier { | |
PageState _state = PageState.idle; | |
/// The current [PageState]. | |
/// This is the main state of the notifier | |
/// and should be used to control the UI. | |
PageState get state => _state; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
final porta = Porta(PortaAberta()); | |
print(porta.estado); | |
porta.fechar(); | |
print(porta.estado); | |
porta.trancar(); | |
print(porta.estado); | |
porta.abrir(); | |
print(porta.estado); |