So I recently learned the if we are not using provider above Material App widget, then if we try to access the provider value after doing a Navigator.push() it will throw an exception :
Unhandled Exception: Error: Could not find the correct Provider above this Consumer Widget
I got to know that when we use Navigator.push(), it changes the route and hence the current widget doesn't belong under the Provider's tree. But we also pass the current widget's build context in Navigator.push(context,(_) => NewWidget()) too right ?
So isn't this passed context used in the new Widget built after Navigator.push()? The information provided after the error stated that the widget should be using the some context of the provider's source. So if I am satisfying this condition then why am I still getting this error ?
Thankyou in advance for answering :)