commandlineExit static method
A function that can be used to exit the app when it is in commandline mode should only be called from afterLoaded function not for use with gui will not close app if _closeOnCompleteCommandlineOptionOnly is false, which is usually for debugging purposes only
Implementation
static commandlineExit({int exitCode = 0}) {
// throw err if not windows
if (!UniversalPlatform.isWindows) {
throw UnsupportedError('Unsupported Platform');
}
// if not called in afterLoaded, throw error, because _closeOnCompleteCommandlineOptionOnly is set in runAppCommandlineOrGUI
if (_closeOnCompleteCommandlineOptionOnly == null) {
throw Exception(
"CommandlineOrGuiWindows: commandlineExit function can only be used in afterLoaded function");
}
// close app using passed or default exit code
if (_closeOnCompleteCommandlineOptionOnly!) {
exit(exitCode);
}
}