How about whether you create a key for a Scaffold screen like this (put this object in the screen state class):
final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
and then set this variable like this:
return new Scaffold(
key: scaffoldKey,
appBar: new AppBar(
.......,
),
, , SnackBar - :
scaffoldKey.currentState
.showSnackBar(new SnackBar(content: new Text("Hello")));
:
void showInSnackBar(String value) {
scaffoldKey.currentState
.showSnackBar(new SnackBar(content: new Text(value)));}
.
, - , .
,