[flutter_tools] migrate some files to null safety (#110354)

This commit is contained in:
Jonah Williams
2022-08-26 11:03:04 -07:00
committed by GitHub
parent 8a40c7ded0
commit 428cafadb0
7 changed files with 50 additions and 52 deletions

View File

@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:meta/meta.dart';

View File

@@ -290,9 +290,9 @@ class FlutterDriverService extends DriverService {
}) async {
if (writeSkslOnExit != null) {
final FlutterView flutterView = (await _vmService.getFlutterViews()).first;
final Map<String, Object> result = await (_vmService.getSkSLs(
final Map<String, Object?>? result = await _vmService.getSkSLs(
viewId: flutterView.id
) as FutureOr<Map<String, Object>>);
);
await sharedSkSlWriter(_device!, result, outputFile: writeSkslOnExit, logger: _logger);
}
// If the application package is available, stop and uninstall.

View File

@@ -934,7 +934,7 @@ abstract class ResidentHandlers {
viewId: views.first.id,
);
final Device device = flutterDevice.device!;
return sharedSkSlWriter(device, data!);
return sharedSkSlWriter(device, data);
}
/// Take a screenshot on the provided [device].

View File

@@ -13,12 +13,12 @@ import 'convert.dart';
import 'device.dart';
import 'globals.dart' as globals;
Future<String?> sharedSkSlWriter(Device device, Map<String, Object?> data, {
Future<String?> sharedSkSlWriter(Device device, Map<String, Object?>? data, {
File? outputFile,
Logger? logger,
}) async {
logger ??= globals.logger;
if (data.isEmpty) {
if (data == null || data.isEmpty) {
logger.printStatus(
'No data was received. To ensure SkSL data can be generated use a '
'physical device then:\n'

View File

@@ -56,7 +56,7 @@ class TestGoldenComparator {
/// to reduce the overhead of starting `flutter_tester`.
Future<TestGoldenComparatorProcess?> _processForTestFile(Uri testUri) async {
if (testUri == _previousTestUri) {
return _previousComparator;
return _previousComparator!;
}
final String bootstrap = TestGoldenComparatorProcess.generateBootstrap(_fileSystem.file(testUri), testUri, logger: _logger);
@@ -68,7 +68,7 @@ class TestGoldenComparator {
_previousComparator = TestGoldenComparatorProcess(process, logger: _logger);
_previousTestUri = testUri;
return _previousComparator;
return _previousComparator!;
}
Future<Process?> _startProcess(String testBootstrap) async {
@@ -100,7 +100,11 @@ class TestGoldenComparator {
Future<String?> compareGoldens(Uri testUri, Uint8List bytes, Uri goldenKey, bool? updateGoldens) async {
final File imageFile = await (await tempDir.createTemp('image')).childFile('image').writeAsBytes(bytes);
final TestGoldenComparatorProcess process = await (_processForTestFile(testUri) as FutureOr<TestGoldenComparatorProcess>);
final TestGoldenComparatorProcess? process = await _processForTestFile(testUri);
if (process == null) {
return 'process was null';
}
process.sendCommand(imageFile, goldenKey, updateGoldens);
final Map<String, dynamic> result = await process.getResponse();