This is dangerous and wrong. The build method should never have side effects.

The point you mentioned is this comment. I agree that I should not make a network call inside the build method. For that I will be using Route . But for this article it was getting complicated to explain. So planning to write another part where I will mention the use of Route.