E.1. What’s the equivalent of a view in Flutter?

In Android, you create all your UI elements with views. In Flutter, everything is a widget, and that’s the closest comparison to a view. (Widgets aren’t exactly the same as views, because they also handle more than just UI, but widgets are used to construct UI of mobile apps also.) For our intent and purpose, they’re close enough. So, if widgets are views, what are the differences?

First, widgets are immutable. They’re light-weight blueprints for the UI that are destroyed as soon as they need to be changed. Every time the configuration or state of a widget changes, Flutter redraws the relevant widget tree. But widgets are just descriptions for actual elements and don’t get drawn to the screen ...

Get Flutter in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.