The BuildContext in Flutter is an object that holds information about the context the Widget is in. Most importantly it holds where in the Widget-tree our Widget is located. This is why we need the BuildContext to get a certain Provider, ThemeData or MediaQuery for instance.
var media = MediaQuery.of(context);
Without the BuildContext belonging to the Widget we are in, Flutter has no way of knowing WHERE (in the Widget-tree) to look for the Data we are looking for.
Same goes for Navigation, we need to know where we are coming from, to go somewhere new.
The BuildContext in Flutter is an object that holds information about the context the Widget is in. Most importantly it holds where in the Widget-tree our Widget is located. This is why we need the BuildContext to get a certain Provider, ThemeData or MediaQuery for instance.
Without the BuildContext belonging to the Widget we are in, Flutter has no way of knowing WHERE (in the Widget-tree) to look for the Data we are looking for.
Same goes for Navigation, we need to know where we are coming from, to go somewhere new.