You have to pass the thing being provided directly to the dialog constructor to access it in the dialog’s new context . You can also give it to a new Provider widget at the top of your dialog tree if you have a very deep widget tree in the dialog and you want to access it from somewhere deeper.
Read moreHow do you call a provider without context Flutter?
“flutter provider without context” Code Answer
Read more