Câu hỏi phỏng vấn Flutter
Câu hỏi

Differentiate StatelessWidget and StatefulWidget ?

Câu trả lời

Here is a concise answer differentiating StatelessWidget and StatefulWidget in Flutter:

StatelessWidgets are immutable - their properties and state cannot change after creation. They are useful for parts of the UI that do not depend on any changes. Examples include Text, Icon, and IconButton[1][2][3].

StatefulWidgets are dynamic - they can change their appearance in response to user interactions or when receiving data. They are useful for parts of the UI that can change over time. Examples include Checkbox, Radio, Slider, InkWell, Form, and TextField[1][2][3].

The key differences are:

  • StatelessWidgets are immutable, StatefulWidgets are dynamic and can change state
  • StatelessWidgets override the build() method, StatefulWidgets override createState() which returns a State object
  • S...
middle

middle

Gợi ý câu hỏi phỏng vấn

junior

How many types of widgets are there in Flutter?

middle

What is debug mode and when do you use it?

middle

Why do we pass functions to widgets?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào