In the “Adding a search button” section, we make use of a “context” variable. However, it isn’t clear to me where this “context” comes from as it doesn’t look like we’ve initialized it anywhere or gotten it from a callback function’s params.
_buildSearchCard() where we create the search button is defined in
class _RecipeListState extends State<RecipeList>, and inside any
State object we have access to the
context property provided by the framework and declared in
This is basically related to OOP in general and not Flutter specifically, if a class
extends another one, the child class will have access to all public members of parent class.
Tip: You can click on the
context variable while holding the CTRL button in VSCode or Android Studio to go to the source code and get some insight.