How can I programmatically close a Flutter application. I\'ve tried popping the only screen but that results in a black screen.
I prefer using
Future.delayed(const Duration(milliseconds: 1000), () {
SystemChannels.platform.invokeMethod('SystemNavigator.pop');
});
Although, exit(0) also works but the app closes abruptly and doesn't look nice, kind of seems that the app has crashed.
Future.delayed(const Duration(milliseconds: 1000), () {
exit(0);
});