context in flutter code example
Example 1: flutter provider without context
class MyState extends State<T> {
MyModel model = MyModel();
@override
void didChangeDependencies() {
super.didChangeDependencies();
model.valueThatComesFromAProvider = Provider.of<MyDependency>(context);
}
}
Example 2: context in flutter
build(BuildContext context) {
// return widget
}