Created
June 27, 2019 18:50
-
-
Save VB10/f78509bb525b422a99d06c1b221fb2e1 to your computer and use it in GitHub Desktop.
BaseModel
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
//Consumer olarak ürettiğimiz sayfalarda değişiklikleri ilgili yerlere haber vermek | |
//için kullanılır | |
abstract class BaseModel extends ChangeNotifier { | |
void setContext(BuildContext context); | |
//Default state ataması her sayfada gelen ve ilk iş yapılmayan anı bize söyler | |
ViewState _state = ViewState.Idle; | |
//sayfalardaki state durumu kontrolü | |
ViewState get state => _state; | |
//setstate ile sayfadaki durumu değiştirip ona göre logic yazılabilir | |
void setState(ViewState state) { | |
_state = state; | |
notifyListeners(); | |
} | |
//işi bildikten sonra memmoryden gerekli sınıfı siler | |
@override | |
void dispose() { | |
super.dispose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment