Unverified Commit 91dd3276 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

migrate vm service to null safety (#88320)

parent 0e784167
This diff is collapsed.
...@@ -471,8 +471,8 @@ abstract class ResidentCompiler { ...@@ -471,8 +471,8 @@ abstract class ResidentCompiler {
List<Uri>? invalidatedFiles, { List<Uri>? invalidatedFiles, {
required String outputPath, required String outputPath,
required PackageConfig packageConfig, required PackageConfig packageConfig,
required String projectRootPath,
required FileSystem fs, required FileSystem fs,
String? projectRootPath,
bool suppressErrors = false, bool suppressErrors = false,
bool checkDartPluginRegistry = false, bool checkDartPluginRegistry = false,
}); });
......
This diff is collapsed.
This diff is collapsed.
...@@ -481,7 +481,7 @@ void main() { ...@@ -481,7 +481,7 @@ void main() {
}); });
testWithoutContext('computeDartVmFlags handles various combinations of Dart VM flags and null_assertions', () { testWithoutContext('computeDartVmFlags handles various combinations of Dart VM flags and null_assertions', () {
expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: null)), ''); expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug)), '');
expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '--foo')), '--foo'); expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '--foo')), '--foo');
expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '', nullAssertions: true)), '--null_assertions'); expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '', nullAssertions: true)), '--null_assertions');
expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '--foo', nullAssertions: true)), '--foo,--null_assertions'); expect(computeDartVmFlags(DebuggingOptions.enabled(BuildInfo.debug, dartFlags: '--foo', nullAssertions: true)), '--foo,--null_assertions');
......
...@@ -796,7 +796,7 @@ void main() { ...@@ -796,7 +796,7 @@ void main() {
}, },
), ),
]); ]);
final FakeDelegateFlutterDevice flutterDevice = FakeDelegateFlutterDevice( final FakeDelegateFlutterDevice flutterDevice = FakeDelegateFlutterDevice(
device, device,
BuildInfo.debug, BuildInfo.debug,
FakeResidentCompiler(), FakeResidentCompiler(),
......
...@@ -2,14 +2,11 @@ ...@@ -2,14 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/convert.dart';
import 'package:flutter_tools/src/vmservice.dart'; import 'package:flutter_tools/src/vmservice.dart';
import 'package:meta/meta.dart';
import 'package:test_api/test_api.dart' hide test; // ignore: deprecated_member_use import 'package:test_api/test_api.dart' hide test; // ignore: deprecated_member_use
import 'package:vm_service/vm_service.dart' as vm_service; import 'package:vm_service/vm_service.dart' as vm_service;
...@@ -19,9 +16,9 @@ export 'package:test_api/test_api.dart' hide test, isInstanceOf; // ignore: depr ...@@ -19,9 +16,9 @@ export 'package:test_api/test_api.dart' hide test, isInstanceOf; // ignore: depr
/// and response structure. /// and response structure.
class FakeVmServiceHost { class FakeVmServiceHost {
FakeVmServiceHost({ FakeVmServiceHost({
@required List<VmServiceExpectation> requests, required List<VmServiceExpectation> requests,
Uri httpAddress, Uri? httpAddress,
Uri wsAddress, Uri? wsAddress,
}) : _requests = requests { }) : _requests = requests {
_vmService = FlutterVmService(vm_service.VmService( _vmService = FlutterVmService(vm_service.VmService(
_input.stream, _input.stream,
...@@ -44,16 +41,16 @@ class FakeVmServiceHost { ...@@ -44,16 +41,16 @@ class FakeVmServiceHost {
return; return;
} }
if (fakeRequest.errorCode == null) { if (fakeRequest.errorCode == null) {
_input.add(json.encode(<String, Object>{ _input.add(json.encode(<String, Object?>{
'jsonrpc': '2.0', 'jsonrpc': '2.0',
'id': request['id'], 'id': request['id'],
'result': fakeRequest.jsonResponse ?? <String, Object>{'type': 'Success'}, 'result': fakeRequest.jsonResponse ?? <String, Object>{'type': 'Success'},
})); }));
} else { } else {
_input.add(json.encode(<String, Object>{ _input.add(json.encode(<String, Object?>{
'jsonrpc': '2.0', 'jsonrpc': '2.0',
'id': request['id'], 'id': request['id'],
'error': <String, Object>{ 'error': <String, Object?>{
'code': fakeRequest.errorCode, 'code': fakeRequest.errorCode,
} }
})); }));
...@@ -67,7 +64,7 @@ class FakeVmServiceHost { ...@@ -67,7 +64,7 @@ class FakeVmServiceHost {
final StreamController<String> _output = StreamController<String>(); final StreamController<String> _output = StreamController<String>();
FlutterVmService get vmService => _vmService; FlutterVmService get vmService => _vmService;
FlutterVmService _vmService; late final FlutterVmService _vmService;
bool get hasRemainingExpectations => _requests.isNotEmpty; bool get hasRemainingExpectations => _requests.isNotEmpty;
...@@ -95,7 +92,7 @@ abstract class VmServiceExpectation { ...@@ -95,7 +92,7 @@ abstract class VmServiceExpectation {
class FakeVmServiceRequest implements VmServiceExpectation { class FakeVmServiceRequest implements VmServiceExpectation {
const FakeVmServiceRequest({ const FakeVmServiceRequest({
@required this.method, required this.method,
this.args = const <String, Object>{}, this.args = const <String, Object>{},
this.jsonResponse, this.jsonResponse,
this.errorCode, this.errorCode,
...@@ -109,9 +106,9 @@ class FakeVmServiceRequest implements VmServiceExpectation { ...@@ -109,9 +106,9 @@ class FakeVmServiceRequest implements VmServiceExpectation {
/// If non-null, the error code for a [vm_service.RPCError] in place of a /// If non-null, the error code for a [vm_service.RPCError] in place of a
/// standard response. /// standard response.
final int errorCode; final int? errorCode;
final Map<String, Object> args; final Map<String, Object>? args;
final Map<String, Object> jsonResponse; final Map<String, Object>? jsonResponse;
@override @override
bool get isRequest => true; bool get isRequest => true;
...@@ -119,8 +116,8 @@ class FakeVmServiceRequest implements VmServiceExpectation { ...@@ -119,8 +116,8 @@ class FakeVmServiceRequest implements VmServiceExpectation {
class FakeVmServiceStreamResponse implements VmServiceExpectation { class FakeVmServiceStreamResponse implements VmServiceExpectation {
const FakeVmServiceStreamResponse({ const FakeVmServiceStreamResponse({
@required this.event, required this.event,
@required this.streamId, required this.streamId,
}); });
final vm_service.Event event; final vm_service.Event event;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment