How can I programmatically close a Flutter application. I\'ve tried popping the only screen but that results in a black screen.
Below worked perfectly with me in both Android and iOS import 'dart:io';
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new ... (...),
floatingActionButton: new FloatingActionButton(
onPressed: ()=> SystemNavigator.pop(),
tooltip: 'Close app',
child: new Icon(Icons.close),
),
);
}