Hello, this is Dr. Ho of IT. Today we will look at 'snackbar' error in flutter.
Usually when using a snackbar
Scaffold.of(context).showSnackBar(Snackbar(content:Text('confirm'))); It is wrapped with 'scaffold' like this, but it overlaps with the first used 'scaffold' and an error occurs.
Builder(builder:(context)=>Center(
child : Button(
onPressed:(){
final snackBar= SnackBar(content:Text('confirm'), );
Scaffold.of(context).showSnackBar(snackBar);
},
),
))
If you wrap it with 'builder' and use it, an error will not occur because of the 'Scaffold' above.
0 Comments