# Chapter 9: Context variable in "Adding a search button"

**URL:** <https://forums.kodeco.com/t/chapter-9-context-variable-in-adding-a-search-button/157017>\
**Category:** Flutter Apprentice\
**Created:** [November 13, 2021, 6:57am UTC](https://forums.kodeco.com/t/chapter-9-context-variable-in-adding-a-search-button/157017 "2021-11-13T06:57:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![matan188](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/matan188/32/81494_2.png) [@matan188](https://forums.kodeco.com/u/matan188)\
**Post date:** [November 13, 2021, 6:57am UTC](https://forums.kodeco.com/t/chapter-9-context-variable-in-adding-a-search-button/157017/1 "2021-11-13T06:57:03Z")

</div>

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.

Thanks.

---

<div class="post-metadata">

**Author:** ![alilosoft](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/alilosoft/32/99601_2.png) [@alilosoft](https://forums.kodeco.com/u/alilosoft)\
**Post date:** [November 15, 2021, 9:54am UTC](https://forums.kodeco.com/t/chapter-9-context-variable-in-adding-a-search-button/157017/2 "2021-11-15T09:54:44Z")

</div>

Hi,  
The method `_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 `framework.dart` file.

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.
