I'm very new to Flutter. I'm trying to learn the Dart syntax and Flutter structure and conventions. It's quite fun. I'm JS developer, react, react native, node.js base. So, I think I'm used to the declarative structure and design.
I'm building a small toy project using the provider. Most global variable and state is in the global state and providing to the whole app. Actually, one of my problems is to open a dialog. I know how to open a dialog with showDialog() method. But, I want to open it by the state of the provider. eg. isOpenCustomDialog state in the provider.
Widget build(BuildContext context) {
var isOpenCustomDialog = Provider.of<Store>(context).isOpenCustomDialog;
// it throws error
if(isOpenCustomDialog) showDialog( ... )
return ...
}
I tried several ways, but no gains and I'd like to know what is the best convention for this purpose.