flutter get context outside widget code example
Example: flutter provider without context
class MyState extends State<T> {
MyModel model = MyModel();
@override
void didChangeDependencies() {
super.didChangeDependencies();
model.valueThatComesFromAProvider = Provider.of<MyDependency>(context);
}
}