Widget tree mô tả cấu trúc UI (blueprint bất biến).
- Element tree theo dõi các widget tồn tại và vòng đời của chúng (có thể thay đổi).
- Render tree xử lý layout và vẽ lên màn hình.
- Khi gọi
setState(), widget rebuild, element cập nhật tham chiếu, và render tree chỉ vẽ lại vùng bị ảnh hưởng. - Hiểu sự tách biệt này giải thích tại sao Flutter hiệu quả.
The widget tree describes the UI structure (immutable blueprint).
- The element tree tracks which widgets exist and their lifecycle (mutable).
- The render tree handles layout and painting.
- When you call
setState(), widgets rebuild, elements update references, and the render tree repaints only affected areas.