1. @override
Future<int> handle()

Handles the command input.

Override this method to perform actions for this command.

Return value is the value returned to the command line operation. Return 0 for success.

Source

@override
Future<int> handle() async {
  var pidFiles = pidFilesInDirectory(projectDirectory);
  if (pidFiles.isEmpty) {
    displayInfo("No server running.");
    return 0;
  }

  displayInfo("Stopping application.");
  pidFiles.forEach((file) {
    var pidString = path_lib
        .relative(file.path, from: projectDirectory.path)
        .split(".")[1];
    stopPidAndDelete(int.parse(pidString));
  });

  displayInfo("Application stopped.");
  return 0;
}