I want to show an AlertDialog when a http get fails. The function showDialog (https://api.flutter.dev/flutter/material/showDialog.html) has the parameter \"@required BuildContex
The accepted answer is wrong.
The dialog only needs the context to access it through an inherited navigateState. You can make your own modified dialog, or use this lib to do this.
https://pub.dev/packages/get
With it you can open dialog from anywhere in your code without context by doing this:
Get.dialog(SimpleDialog());