-
Notifications
You must be signed in to change notification settings - Fork 0
Why VIPER?
When I begin trying to adapt VIPER architecture into this project, I faced the problem that I can't update UI normally as I did in iOS.
For example:
// presenter
view.hideAButton()
// view controller
func hideAButton() {
aButton.isHidden = true
}
But we can't do something like this in Flutter, so we may end up with StatefulWidget
and setState
but they provide some problems. Let's me explain this by this example:
Imagine we have a StatefulWidget with child widgets like below, and our intent that when the user types a wrong email we will set an error message to Error Label
otherwise, it will be emptied.
So if we use setState
for every time we want to update Error Label
it will rebuild the whole tree
This is bad because it reduces the performance, one thing that we sacrifice from native to have write once to everywhere
Ok, so to make it rights Flutter provides for us some solutions: provider, bloc