getDiagnostics method
Get diagnostics (errors, warnings) from the IDE.
Implementation
Future<List<IdeDiagnostic>> getDiagnostics({String? filePath}) async {
final response = await request(
BridgeMessage(
type: BridgeMessageType.getDiagnostics,
payload: {'filePath': ?filePath},
),
);
if (response.type == BridgeMessageType.diagnosticsResponse) {
final diagnostics = response.payload['diagnostics'] as List<dynamic>?;
return diagnostics
?.map((d) => IdeDiagnostic.fromJson(d as Map<String, dynamic>))
.toList() ??
[];
}
return [];
}