closeDialog method
void
closeDialog(
- AFScreenID dialogId,
- dynamic returnValue
inherited
Closes the dialog, and returns the returnValue
to the callback function that was
passed to showDialog.
This is intended to be called from within an AFConnectedDialog. If you call it and a dialog is not open, it will mess up the navigation state.
Implementation
void closeDialog(AFScreenID dialogId, dynamic returnValue) {
final ctx = flutterContext;
// ignore: unused_local_variable
final didNav = (ctx != null && AFibF.g.doMiddlewareNavigation( (navState) {
material.Navigator.pop(ctx, returnValue);
}));
// Uggg. Leaving this in but commented out for now. Originally, this only followed
// the test path if we weren't in the real UI (command line tests, etc). However,
// the problem is that the navigator pop/return is async. So, the return handler won't
// be called synchronously, and tests will fail because the verification code gets called
// before the return logic gets called and does what it was supposed to do. So, now
// we always execute the test path, which forces the return to happen synchronously, in
// any test context, even a real UI test context.
//if(!didNav) {
if(AFibD.config.isTestContext) {
AFibF.g.testOnlySimulateCloseDialogOrSheet(dialogId, returnValue);
}
//} else {
//AFibF.g.testOnlyShowUIReturn[dialogId] = returnValue;
//}
}