What does "context" of "Widget build(BuildContext context)" mean in Flutter?
From the docs, BuildContext
is:
A handle to the location of a widget in the widget tree.
context
is a BuildContext
instance which gets passed to the builder of a widget in order to let it know where it is inside the Widget Tree of your app.
One of the common uses is passing it to the of
method when using an Inherited Widget.
Calling Something.of(context)
, for example, returns the Something
relative to the closest widget in the tree that can provide you that Something
.
You can read more about BuildContext
here in the docs.