[flutter_tools] fix response format of flutterVersion, flutterMemoryInfo (#54786)
This commit is contained in:
@@ -255,7 +255,12 @@ class VMService implements vm_service.VmService {
|
||||
final Map<String, Object> versionJson = version.toJson();
|
||||
versionJson['frameworkRevisionShort'] = version.frameworkRevisionShort;
|
||||
versionJson['engineRevisionShort'] = version.engineRevisionShort;
|
||||
return versionJson;
|
||||
return <String, dynamic>{
|
||||
'result': <String, Object>{
|
||||
'type': 'Success',
|
||||
...versionJson,
|
||||
}
|
||||
};
|
||||
});
|
||||
_delegateService.registerService('flutterVersion', 'Flutter Tools');
|
||||
|
||||
@@ -306,8 +311,21 @@ class VMService implements vm_service.VmService {
|
||||
}
|
||||
if (device != null) {
|
||||
_delegateService.registerServiceCallback('flutterMemoryInfo', (Map<String, dynamic> params) async {
|
||||
final MemoryInfo result = await device.queryMemoryInfo();
|
||||
return result.toJson();
|
||||
try {
|
||||
final MemoryInfo result = await device.queryMemoryInfo();
|
||||
return <String, dynamic>{
|
||||
'result': <String, Object>{
|
||||
'type': 'Success',
|
||||
...result.toJson(),
|
||||
}
|
||||
};
|
||||
} on Exception catch (e, st) {
|
||||
throw vm_service.RPCError(
|
||||
'Error during memory info query $e\n$st',
|
||||
RPCErrorCodes.kServerError,
|
||||
'',
|
||||
);
|
||||
}
|
||||
});
|
||||
_delegateService.registerService('flutterMemoryInfo', 'Flutter Tools');
|
||||
}
|
||||
@@ -354,6 +372,7 @@ class VMService implements vm_service.VmService {
|
||||
final io.WebSocket channel = await _openChannel(wsUri.toString(), compression: compression);
|
||||
final StreamController<dynamic> primary = StreamController<dynamic>();
|
||||
final StreamController<dynamic> secondary = StreamController<dynamic>();
|
||||
|
||||
// Create an instance of the package:vm_service API in addition to the flutter
|
||||
// tool's to allow gradual migration.
|
||||
final Completer<void> streamClosedCompleter = Completer<void>();
|
||||
@@ -371,7 +390,6 @@ class VMService implements vm_service.VmService {
|
||||
primary.addError(error, stackTrace);
|
||||
secondary.addError(error, stackTrace);
|
||||
});
|
||||
|
||||
final vm_service.VmService delegateService = vm_service.VmService(
|
||||
primary.stream,
|
||||
channel.add,
|
||||
|
||||
Reference in New Issue
Block a user