# Chapter 6: simple question on usage of 'const' on home.dart

**URL:** <https://forums.kodeco.com/t/chapter-6-simple-question-on-usage-of-const-on-home-dart/154536>\
**Category:** Flutter Apprentice\
**Created:** [October 23, 2021, 8:19pm UTC](https://forums.kodeco.com/t/chapter-6-simple-question-on-usage-of-const-on-home-dart/154536 "2021-10-23T20:19:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![helvecio](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/helvecio/32/100497_2.png) [@helvecio](https://forums.kodeco.com/u/helvecio)\
**Post date:** [October 23, 2021, 8:19pm UTC](https://forums.kodeco.com/t/chapter-6-simple-question-on-usage-of-const-on-home-dart/154536/1 "2021-10-23T20:19:24Z")

</div>

Hi, all. Very specific here, but could anyone explain why the ‘const’ is needed for GroceryScreen(), but neither for ExploreScreen() nor for RecipesScreen() on ‘\_HomeState extends’ on home.dart?

Thanks,

H

---

<div class="post-metadata">

**Author:** ![jomoka](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jomoka/32/109828_2.png) [@jomoka](https://forums.kodeco.com/u/jomoka)\
**Post date:** [October 24, 2021, 2:31am UTC](https://forums.kodeco.com/t/chapter-6-simple-question-on-usage-of-const-on-home-dart/154536/2 "2021-10-24T02:31:23Z")

</div>

@helvecio const is actually not necessary, but recommended by flutter. The linter will throw a warning if you don’t add const to `GroceryScreen`.

The `const` keyword lets you know that this variable is known at compile time, and never changes. By adding const, it lets flutter know to only rebuild widgets that need updating.

In the case of ExploreScreen() and RecipesScreen(), they both depend on the **MockFooderlichService** which provides data asynchronously. For example you could modify the content in the JSON, and do a pull to refresh to update the list.

---

<div class="post-metadata">

**Author:** ![helvecio](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/helvecio/32/100497_2.png) [@helvecio](https://forums.kodeco.com/u/helvecio)\
**Post date:** [October 24, 2021, 6:22pm UTC](https://forums.kodeco.com/t/chapter-6-simple-question-on-usage-of-const-on-home-dart/154536/3 "2021-10-24T18:22:18Z")

</div>

hey, @jomoka, many thanks for this, clear and very useful. thanks indeed.
