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 that 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 with that Something.

You can read more about BuildContext here in the docs.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)