Comments (5)
Correct, I forgot about that, you can introduce BuildContext
anywhere you want in that way for efficiency. I don't think there will be significant performance differences most of the time, because rebuilding is fairly lightweight once the Element
tree is built. Also it's good style to keep widgets small in terms of tree size.
I'll update the docs.
from flutter_reactive_value.
It's the widget that is the BuildContext
passed into reactiveValue
that is scheduled to be rebuilt. BuildContext
is actually an Element
, so technically it's the Element
, not the Widget
, that is rebuilt -- Element
is the laid-out view of a widget. The scheduling happens via Element.markMeedsBuild()
.
This may trigger other elements to be rebuilt too, especially if the size of the Element
changes, since constraints are passed down the Element
tree and sizes are passed back up. And of course it will trigger a render frame, which (I assume) will only redraw the area of the screen that was marked for rebuilding, but I'm not sure about that.
I should update the docs to make this clearer, sorry!
from flutter_reactive_value.
Sorry, I reread your question... The Text
Widget optimally would be the only one rebuilt, yes. But it has no BuildContext
, so there's no way to get a reference to it.
In general you should be breaking large coplex widget trees down into separate widgets, for readability if nothing else, so usually widget trees go only a few layers deep below a BuildContext
, and the re-layout should not be horribly wasteful.
from flutter_reactive_value.
The Builder widget could provide the parents BuildContext
exactly where and when you need it.
from flutter_reactive_value.
@AntonEriksson978 The docs are updated. Thanks for pointing this out, it is an important point!
from flutter_reactive_value.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_reactive_value.