[flutter_tools] make expando on vm service null safe to handle web stuff (#59624)

This commit is contained in:
Jonah Williams
2020-06-18 08:18:04 -07:00
committed by GitHub
parent dbc6dca5d0
commit 719ea5a8c0
2 changed files with 9 additions and 2 deletions

View File

@@ -444,9 +444,9 @@ class FlutterView {
/// Flutter specific VM Service functionality.
extension FlutterVmService on vm_service.VmService {
Uri get wsAddress => _wsAddressExpando[this];
Uri get wsAddress => this != null ? _wsAddressExpando[this] : null;
Uri get httpAddress => _httpAddressExpando[this];
Uri get httpAddress => this != null ? _httpAddressExpando[this] : null;
/// Set the asset directory for the an attached Flutter view.
Future<void> setAssetDirectory({

View File

@@ -395,6 +395,13 @@ void main() {
);
expect(fakeVmServiceHost.hasRemainingExpectations, false);
});
testWithoutContext('expandos are null safe', () {
vm_service.VmService vmService;
expect(vmService.httpAddress, null);
expect(vmService.wsAddress, null);
});
}
class MockDevice extends Mock implements Device {}