Undefined name 'context'

前端 未结 1 1453
予麋鹿
予麋鹿 2021-01-22 15:08

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

相关标签:
1条回答
  • 2021-01-22 15:33

    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 {
    ...
    
    0 讨论(0)
提交回复
热议问题