Ad

Flutter Error Getting Context After Updating Mvc_pattern Library To The Last Version 6.4.0

- 1 answer

before updating to the last version i am using context when calling it inside the controller like this:

scaffoldKey?.currentState?.showSnackBar(SnackBar(
        content: Text(S.of(context).verify_your_internet_connection),
      ));

now it give me this error:

Undefined name of 'context'

this issue is confusing now ? the context cannot be gotten inside controller now after updating the mvc_pattern addons to the last version 6.4.0, how to get it? is there are any keys or something to get the context inside controller ?

Ad

Answer

i opened an issue inside the plugin github account here and got this response:
After 6.0.0, you can get context through the getter, state.

BuildContext contxt = con.state.context;
Ad
source: stackoverflow.com
Ad