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