Migrate flutter_tool tool helper files to null safety (#78845)

This commit is contained in:
Jenn Magder
2021-03-23 10:02:59 -07:00
committed by GitHub
parent b921a2443f
commit 0bde67e734
14 changed files with 18 additions and 47 deletions

View File

@@ -2,14 +2,12 @@
// 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:convert';
import 'dart:io';
import 'package:flutter_tools/src/base/common.dart';
Process daemon;
late Process daemon;
// To use, start from the console and enter:
// version: print version
@@ -85,7 +83,7 @@ Future<void> main() async {
});
// Print in the callback can't fail.
unawaited(daemon.exitCode.then<void>((int code) {
unawaited(daemon.exitCode.then<int>((int code) {
print('daemon exiting ($code)');
exit(code);
}));

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.
// @dart = 2.8
import 'dart:io';
import 'package:path/path.dart' as path;
@@ -27,7 +25,7 @@ int countGlobalImports(Directory directory) {
if (!file.path.endsWith('.dart') || file is! File) {
continue;
}
final bool hasImport = (file as File).readAsLinesSync().any((String line) {
final bool hasImport = file.readAsLinesSync().any((String line) {
return globalImport.hasMatch(line);
});
if (hasImport) {

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.
// @dart = 2.8
import 'dart:io';
/// Produces a per-library coverage summary when fed an lcov file, sorted by
@@ -17,7 +15,7 @@ void main(List<String> args) {
}
final List<String> lines = File(args.single).readAsLinesSync();
final List<Coverage> coverages = <Coverage>[];
Coverage currentCoverage;
Coverage? currentCoverage;
for (final String line in lines) {
if (line.startsWith('SF:')) {
@@ -26,9 +24,9 @@ void main(List<String> args) {
coverages.add(currentCoverage);
}
if (line.startsWith('DA')) {
currentCoverage.totalLines += 1;
currentCoverage?.totalLines += 1;
if (!line.endsWith(',0')) {
currentCoverage.testedLines += 1;
currentCoverage?.testedLines += 1;
}
}
if (line == 'end_of_record') {
@@ -53,7 +51,7 @@ void main(List<String> args) {
}
class Coverage {
String library;
String? library;
int totalLines = 0;
int testedLines = 0;
}