remove the unused hintMessage and hintId fields from the reload results (#31267)

This commit is contained in:
Devon Carew 2019-04-18 11:00:54 -07:00 committed by GitHub
parent 80971335c1
commit d075d647c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 3 additions and 27 deletions

View File

@ -78,7 +78,7 @@ It is up to the client to decide how best to display the message; for some clien
#### app.restart
The `restart()` restarts the given application. It returns a Map of `{ int code, String message, String hintMessage, String hintId }` to indicate success or failure in restarting the app. A `code` of `0` indicates success, and non-zero indicates a failure. If `hintId` is non-null and equal to `restartRecommended`, that indicates that the reload was successful, but not all reloaded elements were executed during view reassembly (i.e., the user might not see all the changes in the current UI, and a restart could be necessary).
The `restart()` restarts the given application. It returns a Map of `{ int code, String message }` to indicate success or failure in restarting the app. A `code` of `0` indicates success, and non-zero indicates a failure.
- `appId`: the id of a previously started app; this is required.
- `fullRestart`: optional; whether to do a full (rather than an incremental) restart of the application

View File

@ -722,17 +722,10 @@ Map<String, dynamic> _emulatorToMap(Emulator emulator) {
}
Map<String, dynamic> _operationResultToMap(OperationResult result) {
final Map<String, dynamic> map = <String, dynamic>{
return <String, dynamic>{
'code': result.code,
'message': result.message,
};
if (result.hintMessage != null)
map['hintMessage'] = result.hintMessage;
if (result.hintId != null)
map['hintId'] = result.hintId;
return map;
}
dynamic _toJsonable(dynamic obj) {

View File

@ -1017,7 +1017,7 @@ abstract class ResidentRunner {
}
class OperationResult {
OperationResult(this.code, this.message, { this.hintMessage, this.hintId });
OperationResult(this.code, this.message);
/// The result of the operation; a non-zero code indicates a failure.
final int code;
@ -1025,17 +1025,6 @@ class OperationResult {
/// A user facing message about the results of the operation.
final String message;
/// An optional hint about the results of the operation. This is used to provide
/// sidecar data about the operation results. For example, this is used when
/// a reload is successful but some changed program elements where not run after a
/// reassemble.
final String hintMessage;
/// A key used by tools to discriminate between different kinds of operation results.
/// For example, a successful reload might have a [code] of 0 and a [hintId] of
/// `'restartRecommended'`.
final String hintId;
bool get isOk => code == 0;
static final OperationResult ok = OperationResult(0, '');

View File

@ -586,8 +586,6 @@ class HotRunner extends ResidentRunner {
printStatus('${result.message}.');
}
}
if (result.hintMessage != null)
printStatus('\n${result.hintMessage}');
return result;
}
}

View File

@ -293,10 +293,6 @@ void main() {
jsonEncodeObject(OperationResult(1, 'foo')),
'{"code":1,"message":"foo"}',
);
expect(
jsonEncodeObject(OperationResult(0, 'foo', hintMessage: 'my hint', hintId: 'myId')),
'{"code":0,"message":"foo","hintMessage":"my hint","hintId":"myId"}',
);
});
});
}