close method

Future<bool> close([
  1. String? app
])

Closes either the specified app or if none given the current app

Implementation

Future<bool> close([String? app]) async {
  final toClose = app ?? await getCurrentApp();
  if (toClose != null) {
    HttpClientResponse? response;
    try {
      response = await send('DELETE', '/apps/$toClose');
      if (response.statusCode != 200) {
        return false;
      }
      return true;
    } finally {
      if (response != null) {
        await response.drain();
      }
    }
  }
  return false;
}