2

I am new to flutter, following the flutter.io and in widgets topic we have the Alert Dialog class widget, https://docs.flutter.io/flutter/material/AlertDialog-class.html

There we have some sample code and getting the below errors in it. Can anyone help in solving them.

screenshot

Thanks.

nvoigt
  • 68,786
  • 25
  • 88
  • 134
Sai Sushmitha
  • 559
  • 1
  • 7
  • 11

1 Answers1

2

Because this method is defined what looks to be outside of a Widget class, the context member of a Widget class doesn't exist. You need to pass one into this method when you use.

Changed your method to this:

...
Future<void> _neverSatisfied(BuildContext context) async {
...
Tom Alabaster
  • 945
  • 6
  • 12