getCurrentApp method

Future<String?> getCurrentApp()

Returns the name of the specified or otherwise null

Implementation

Future<String?> getCurrentApp() async {
  HttpClientResponse? response;
  try {
    response = await send('GET', '/apps');
    if (response.statusCode == 302) {
      final loc = response.headers.value('location')!;
      final uri = Uri.parse(loc);
      return uri.pathSegments[1];
    }
    return null;
  } finally {
    if (response != null) {
      await response.drain();
    }
  }
}