inspect method
The project graph the paired server answers dartvel inspect with,
for the dev menu's inspectors. Over the same pinned connection, with the
token. Throws DVDevClientInspectionException saying why it could not.
Implementation
Future<DVDevClientInspection> inspect() async {
final HttpClient http = dvDevClientHttpClient(pairing);
try {
final HttpClientRequest request = await http.getUrl(pairing.graphUri());
request.headers.set('authorization', 'Bearer ${pairing.token}');
final HttpClientResponse response = await request.close().timeout(timeout);
final String body = await utf8.decodeStream(response);
if (response.statusCode != 200) {
throw DVDevClientInspectionException(
'the dev server answered HTTP ${response.statusCode}: $body',
);
}
final Object? graph = jsonDecode(body);
if (graph is! Map) {
throw const DVDevClientInspectionException(
'the dev server answered something that is not a project graph',
);
}
return DVDevClientInspection.fromGraph(graph.cast<String, Object?>());
} on DVDevClientInspectionException {
rethrow;
} on Object catch (error) {
throw DVDevClientInspectionException('$error');
} finally {
http.close(force: true);
}
}