The Context
is just a reference to identify your widget within the structure tree.
Each Context
belongs only to a Widget. We can also understand that if a particular Widget "A" has children, the Context
of the "A" widget will be the parent context of your children...
We can access this inheritance through of
, as an example:
Algumacoisa.of(context)
So it will be returned to us this "Somemacoisa" of the Widget closest to the tree.
A more practical example is when we use the command MediaQuery.of(context).size
, which returns us the dimensions of our device, based on the Widget MaterialApp
closest to the tree.
There is a question similar to yours at Stackoverflow in English if you want to take a look.
Source: Widget - State - Context - Inheritedwidget
Lots of good answer, man. Congratulations!
– rbz