apply lint prefer_void_to_null in dev/ (#22661)
diff --git a/dev/bots/analyze-sample-code.dart b/dev/bots/analyze-sample-code.dart
index e4e643a..4b23b82 100644
--- a/dev/bots/analyze-sample-code.dart
+++ b/dev/bots/analyze-sample-code.dart
@@ -99,7 +99,7 @@
const String kDartDocPrefix = '///';
const String kDartDocPrefixWithSpace = '$kDartDocPrefix ';
-Future<Null> main(List<String> arguments) async {
+Future<void> main(List<String> arguments) async {
final Directory tempDir = Directory.systemTemp.createTempSync('flutter_analyze_sample_code.');
int exitCode = 1;
bool keepMain = false;
diff --git a/dev/bots/analyze.dart b/dev/bots/analyze.dart
index 20b70d9..1b911ef 100644
--- a/dev/bots/analyze.dart
+++ b/dev/bots/analyze.dart
@@ -11,8 +11,6 @@
import 'run_command.dart';
-typedef ShardRunner = Future<Null> Function();
-
final String flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(Platform.script))));
final String flutter = path.join(flutterRoot, 'bin', Platform.isWindows ? 'flutter.bat' : 'flutter');
final String dart = path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', Platform.isWindows ? 'dart.exe' : 'dart');
@@ -25,7 +23,7 @@
///
/// For example:
/// bin/cache/dart-sdk/bin/dart dev/bots/analyze.dart --dart-sdk=/tmp/dart-sdk
-Future<Null> main(List<String> args) async {
+Future<void> main(List<String> args) async {
await _verifyNoTestPackageImports(flutterRoot);
await _verifyGeneratedPluginRegistrants(flutterRoot);
await _verifyNoBadImportsInFlutter(flutterRoot);
@@ -84,7 +82,7 @@
print('${bold}DONE: Analysis successful.$reset');
}
-Future<Null> _verifyInternationalizations() async {
+Future<void> _verifyInternationalizations() async {
final EvalResult genResult = await _evalCommand(
dart,
<String>[
@@ -134,7 +132,7 @@
}
-Future<Null> _checkForTrailingSpaces() async {
+Future<void> _checkForTrailingSpaces() async {
if (!Platform.isWindows) {
final String commitRange = Platform.environment.containsKey('TEST_COMMIT_RANGE')
? Platform.environment['TEST_COMMIT_RANGE']
@@ -229,7 +227,7 @@
return result;
}
-Future<Null> _runFlutterAnalyze(String workingDirectory, {
+Future<void> _runFlutterAnalyze(String workingDirectory, {
List<String> options = const <String>[]
}) {
return runCommand(flutter, <String>['analyze']..addAll(options),
@@ -237,7 +235,7 @@
);
}
-Future<Null> _verifyNoTestPackageImports(String workingDirectory) async {
+Future<void> _verifyNoTestPackageImports(String workingDirectory) async {
// TODO(ianh): Remove this whole test once https://github.com/dart-lang/matcher/issues/98 is fixed.
final List<String> shims = <String>[];
final List<String> errors = Directory(workingDirectory)
@@ -315,7 +313,7 @@
}
}
-Future<Null> _verifyNoBadImportsInFlutter(String workingDirectory) async {
+Future<void> _verifyNoBadImportsInFlutter(String workingDirectory) async {
final List<String> errors = <String>[];
final String libPath = path.join(workingDirectory, 'packages', 'flutter', 'lib');
final String srcPath = path.join(workingDirectory, 'packages', 'flutter', 'lib', 'src');
@@ -439,7 +437,7 @@
return null;
}
-Future<Null> _verifyNoBadImportsInFlutterTools(String workingDirectory) async {
+Future<void> _verifyNoBadImportsInFlutterTools(String workingDirectory) async {
final List<String> errors = <String>[];
for (FileSystemEntity entity in Directory(path.join(workingDirectory, 'packages', 'flutter_tools', 'lib'))
.listSync(recursive: true)
@@ -463,7 +461,7 @@
}
}
-Future<Null> _verifyGeneratedPluginRegistrants(String flutterRoot) async {
+Future<void> _verifyGeneratedPluginRegistrants(String flutterRoot) async {
final Directory flutterRootDir = Directory(flutterRoot);
final Map<String, List<File>> packageToRegistrants = <String, List<File>>{};
diff --git a/dev/bots/prepare_package.dart b/dev/bots/prepare_package.dart
index 116018e..ec7f52f 100644
--- a/dev/bots/prepare_package.dart
+++ b/dev/bots/prepare_package.dart
@@ -119,8 +119,8 @@
stderr.write('Running "${commandLine.join(' ')}" in ${workingDirectory.path}.\n');
}
final List<int> output = <int>[];
- final Completer<Null> stdoutComplete = Completer<Null>();
- final Completer<Null> stderrComplete = Completer<Null>();
+ final Completer<void> stdoutComplete = Completer<void>();
+ final Completer<void> stderrComplete = Completer<void>();
Process process;
Future<int> allComplete() async {
await stderrComplete.future;
@@ -291,7 +291,7 @@
/// Clone the Flutter repo and make sure that the git environment is sane
/// for when the user will unpack it.
- Future<Null> _checkoutFlutter() async {
+ Future<void> _checkoutFlutter() async {
// We want the user to start out the in the specified branch instead of a
// detached head. To do that, we need to make sure the branch points at the
// desired revision.
@@ -303,7 +303,7 @@
}
/// Retrieve the MinGit executable from storage and unpack it.
- Future<Null> _installMinGitIfNeeded() async {
+ Future<void> _installMinGitIfNeeded() async {
if (!platform.isWindows) {
return;
}
@@ -319,7 +319,7 @@
/// Prepare the archive repo so that it has all of the caches warmed up and
/// is configured for the user to begin working.
- Future<Null> _populateCaches() async {
+ Future<void> _populateCaches() async {
await _runFlutter(<String>['doctor']);
await _runFlutter(<String>['update-packages']);
await _runFlutter(<String>['precache']);
@@ -342,7 +342,7 @@
}
/// Write the archive to the given output file.
- Future<Null> _archiveFiles(File outputFile) async {
+ Future<void> _archiveFiles(File outputFile) async {
if (outputFile.path.toLowerCase().endsWith('.zip')) {
await _createZipArchive(outputFile, flutterRoot);
} else if (outputFile.path.toLowerCase().endsWith('.tar.xz')) {
@@ -454,7 +454,7 @@
static String getMetadataFilename(Platform platform) => 'releases_${platform.operatingSystem.toLowerCase()}.json';
/// Publish the archive to Google Storage.
- Future<Null> publishArchive() async {
+ Future<void> publishArchive() async {
final String destGsPath = '$gsReleaseFolder/$destinationArchivePath';
await _cloudCopy(outputFile.absolute.path, destGsPath);
assert(tempDir.existsSync());
@@ -497,7 +497,7 @@
return jsonData;
}
- Future<Null> _updateMetadata() async {
+ Future<void> _updateMetadata() async {
// We can't just cat the metadata from the server with 'gsutil cat', because
// Windows wants to echo the commands that execute in gsutil.bat to the
// stdout when we do that. So, we copy the file locally and then read it
@@ -569,7 +569,7 @@
///
/// Archives contain the executables and customizations for the platform that
/// they are created on.
-Future<Null> main(List<String> argList) async {
+Future<void> main(List<String> argList) async {
final ArgParser argParser = ArgParser();
argParser.addOption(
'temp_dir',
diff --git a/dev/bots/run_command.dart b/dev/bots/run_command.dart
index 0f32200..6b8f689 100644
--- a/dev/bots/run_command.dart
+++ b/dev/bots/run_command.dart
@@ -30,7 +30,7 @@
print('$arrow $action: cd $cyan$workingDir$reset; $yellow$command$reset');
}
-Future<Null> runCommand(String executable, List<String> arguments, {
+Future<void> runCommand(String executable, List<String> arguments, {
String workingDirectory,
Map<String, String> environment,
bool expectNonZeroExit = false,
diff --git a/dev/bots/test.dart b/dev/bots/test.dart
index a3cf5d1..3a8b62d 100644
--- a/dev/bots/test.dart
+++ b/dev/bots/test.dart
@@ -9,7 +9,7 @@
import 'run_command.dart';
-typedef ShardRunner = Future<Null> Function();
+typedef ShardRunner = Future<void> Function();
final String flutterRoot = path.dirname(path.dirname(path.dirname(path.fromUri(Platform.script))));
final String flutter = path.join(flutterRoot, 'bin', Platform.isWindows ? 'flutter.bat' : 'flutter');
@@ -37,7 +37,7 @@
/// For example:
/// SHARD=tool_tests bin/cache/dart-sdk/bin/dart dev/bots/test.dart
/// bin/cache/dart-sdk/bin/dart dev/bots/test.dart --local-engine=host_debug_unopt
-Future<Null> main(List<String> args) async {
+Future<void> main(List<String> args) async {
flutterTestArgs.addAll(args);
final String shard = Platform.environment['SHARD'];
@@ -58,7 +58,7 @@
}
}
-Future<Null> _runSmokeTests() async {
+Future<void> _runSmokeTests() async {
// Verify that the tests actually return failure on failure and success on
// success.
final String automatedTests = path.join(flutterRoot, 'dev', 'automated_tests');
@@ -138,7 +138,7 @@
await _verifyVersion(path.join(flutterRoot, 'version'));
}
-Future<Null> _runToolTests() async {
+Future<void> _runToolTests() async {
await _runSmokeTests();
await _pubRunTest(
@@ -149,7 +149,7 @@
print('${bold}DONE: All tests successful.$reset');
}
-Future<Null> _runTests() async {
+Future<void> _runTests() async {
await _runSmokeTests();
await _runFlutterTest(path.join(flutterRoot, 'packages', 'flutter'));
@@ -171,7 +171,7 @@
print('${bold}DONE: All tests successful.$reset');
}
-Future<Null> _runCoverage() async {
+Future<void> _runCoverage() async {
final File coverageFile = File(path.join(flutterRoot, 'packages', 'flutter', 'coverage', 'lcov.info'));
if (!coverageFile.existsSync()) {
print('${red}Coverage file not found.$reset');
@@ -193,7 +193,7 @@
print('${bold}DONE: Coverage collection successful.$reset');
}
-Future<Null> _pubRunTest(
+Future<void> _pubRunTest(
String workingDirectory, {
String testPath,
bool enableFlutterToolAsserts = false
@@ -234,7 +234,7 @@
final int exitCode;
}
-Future<Null> _runFlutterTest(String workingDirectory, {
+Future<void> _runFlutterTest(String workingDirectory, {
String script,
bool expectFailure = false,
bool printOutput = true,
@@ -268,7 +268,7 @@
);
}
-Future<Null> _verifyVersion(String filename) async {
+Future<void> _verifyVersion(String filename) async {
if (!File(filename).existsSync()) {
print('$redLine');
print('The version logic failed to create the Flutter version file.');