Unverified Commit 2d3ff10d authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

apply lint prefer_void_to_null in packages/flutter_tools (#22686)

parent c26b56cb
...@@ -30,20 +30,20 @@ const List<String> _kRequiredOptions = <String>[ ...@@ -30,20 +30,20 @@ const List<String> _kRequiredOptions = <String>[
_kOptionComponentName, _kOptionComponentName,
]; ];
Future<Null> main(List<String> args) { Future<void> main(List<String> args) {
return runInContext<Null>(() => run(args), overrides: <Type, Generator>{ return runInContext<void>(() => run(args), overrides: <Type, Generator>{
Usage: () => DisabledUsage(), Usage: () => DisabledUsage(),
}); });
} }
Future<Null> writeFile(libfs.File outputFile, DevFSContent content) async { Future<void> writeFile(libfs.File outputFile, DevFSContent content) async {
outputFile.createSync(recursive: true); outputFile.createSync(recursive: true);
final List<int> data = await content.contentsAsBytes(); final List<int> data = await content.contentsAsBytes();
outputFile.writeAsBytesSync(data); outputFile.writeAsBytesSync(data);
return null; return null;
} }
Future<Null> run(List<String> args) async { Future<void> run(List<String> args) async {
final ArgParser parser = ArgParser() final ArgParser parser = ArgParser()
..addOption(_kOptionPackages, help: 'The .packages file') ..addOption(_kOptionPackages, help: 'The .packages file')
..addOption(_kOptionAsset, ..addOption(_kOptionAsset,
...@@ -72,18 +72,18 @@ Future<Null> run(List<String> args) async { ...@@ -72,18 +72,18 @@ Future<Null> run(List<String> args) async {
exit(1); exit(1);
} }
final List<Future<Null>> calls = <Future<Null>>[]; final List<Future<void>> calls = <Future<void>>[];
assets.entries.forEach((String fileName, DevFSContent content) { assets.entries.forEach((String fileName, DevFSContent content) {
final libfs.File outputFile = libfs.fs.file(libfs.fs.path.join(assetDir, fileName)); final libfs.File outputFile = libfs.fs.file(libfs.fs.path.join(assetDir, fileName));
calls.add(writeFile(outputFile, content)); calls.add(writeFile(outputFile, content));
}); });
await Future.wait<Null>(calls); await Future.wait<void>(calls);
final String outputMan = argResults[_kOptionAssetManifestOut]; final String outputMan = argResults[_kOptionAssetManifestOut];
await writeFuchsiaManifest(assets, argResults[_kOptionAsset], outputMan, argResults[_kOptionComponentName]); await writeFuchsiaManifest(assets, argResults[_kOptionAsset], outputMan, argResults[_kOptionComponentName]);
} }
Future<Null> writeFuchsiaManifest(AssetBundle assets, String outputBase, String fileDest, String componentName) async { Future<void> writeFuchsiaManifest(AssetBundle assets, String outputBase, String fileDest, String componentName) async {
final libfs.File destFile = libfs.fs.file(fileDest); final libfs.File destFile = libfs.fs.file(fileDest);
await destFile.create(recursive: true); await destFile.create(recursive: true);
......
...@@ -43,12 +43,12 @@ const String _kOptionCoverage = 'coverage'; ...@@ -43,12 +43,12 @@ const String _kOptionCoverage = 'coverage';
const String _kOptionCoveragePath = 'coverage-path'; const String _kOptionCoveragePath = 'coverage-path';
void main(List<String> args) { void main(List<String> args) {
runInContext<Null>(() => run(args), overrides: <Type, Generator>{ runInContext<void>(() => run(args), overrides: <Type, Generator>{
Usage: () => DisabledUsage(), Usage: () => DisabledUsage(),
}); });
} }
Future<Null> run(List<String> args) async { Future<void> run(List<String> args) async {
final ArgParser parser = ArgParser() final ArgParser parser = ArgParser()
..addOption(_kOptionPackages, help: 'The .packages file') ..addOption(_kOptionPackages, help: 'The .packages file')
..addOption(_kOptionShell, help: 'The Flutter shell binary') ..addOption(_kOptionShell, help: 'The Flutter shell binary')
......
...@@ -39,7 +39,7 @@ import 'src/runner/flutter_command.dart'; ...@@ -39,7 +39,7 @@ import 'src/runner/flutter_command.dart';
/// Main entry point for commands. /// Main entry point for commands.
/// ///
/// This function is intended to be used from the `flutter` command line tool. /// This function is intended to be used from the `flutter` command line tool.
Future<Null> main(List<String> args) async { Future<void> main(List<String> args) async {
final bool verbose = args.contains('-v') || args.contains('--verbose'); final bool verbose = args.contains('-v') || args.contains('--verbose');
final bool doctor = (args.isNotEmpty && args.first == 'doctor') || final bool doctor = (args.isNotEmpty && args.first == 'doctor') ||
......
...@@ -211,7 +211,7 @@ Future<int> _exit(int code) async { ...@@ -211,7 +211,7 @@ Future<int> _exit(int code) async {
// Run shutdown hooks before flushing logs // Run shutdown hooks before flushing logs
await runShutdownHooks(); await runShutdownHooks();
final Completer<Null> completer = Completer<Null>(); final Completer<void> completer = Completer<void>();
// Give the task / timer queue one cycle through before we hard exit. // Give the task / timer queue one cycle through before we hard exit.
Timer.run(() { Timer.run(() {
......
...@@ -676,7 +676,7 @@ class _AdbLogReader extends DeviceLogReader { ...@@ -676,7 +676,7 @@ class _AdbLogReader extends DeviceLogReader {
_timeOrigin = _adbTimestampToDateTime(lastTimestamp); _timeOrigin = _adbTimestampToDateTime(lastTimestamp);
else else
_timeOrigin = null; _timeOrigin = null;
runCommand(device.adbCommandForDevice(args)).then<Null>((Process process) { runCommand(device.adbCommandForDevice(args)).then<void>((Process process) {
_process = process; _process = process;
const Utf8Decoder decoder = Utf8Decoder(allowMalformed: true); const Utf8Decoder decoder = Utf8Decoder(allowMalformed: true);
_process.stdout.transform<String>(decoder).transform<String>(const LineSplitter()).listen(_onLine); _process.stdout.transform<String>(decoder).transform<String>(const LineSplitter()).listen(_onLine);
...@@ -868,7 +868,7 @@ class _AndroidDevicePortForwarder extends DevicePortForwarder { ...@@ -868,7 +868,7 @@ class _AndroidDevicePortForwarder extends DevicePortForwarder {
} }
@override @override
Future<Null> unforward(ForwardedPort forwardedPort) async { Future<void> unforward(ForwardedPort forwardedPort) async {
await runCheckedAsync(device.adbCommandForDevice( await runCheckedAsync(device.adbCommandForDevice(
<String>['forward', '--remove', 'tcp:${forwardedPort.hostPort}'] <String>['forward', '--remove', 'tcp:${forwardedPort.hostPort}']
)); ));
......
...@@ -14,7 +14,7 @@ import '../project.dart'; ...@@ -14,7 +14,7 @@ import '../project.dart';
import 'android_sdk.dart'; import 'android_sdk.dart';
import 'gradle.dart'; import 'gradle.dart';
Future<Null> buildApk({ Future<void> buildApk({
@required FlutterProject project, @required FlutterProject project,
@required String target, @required String target,
BuildInfo buildInfo = BuildInfo.debug BuildInfo buildInfo = BuildInfo.debug
......
...@@ -272,7 +272,7 @@ void _exitIfNoAndroidSdk() { ...@@ -272,7 +272,7 @@ void _exitIfNoAndroidSdk() {
} }
} }
Future<Null> buildGradleProject({ Future<void> buildGradleProject({
@required FlutterProject project, @required FlutterProject project,
@required BuildInfo buildInfo, @required BuildInfo buildInfo,
@required String target, @required String target,
...@@ -301,7 +301,7 @@ Future<Null> buildGradleProject({ ...@@ -301,7 +301,7 @@ Future<Null> buildGradleProject({
} }
} }
Future<Null> _buildGradleProjectV1(FlutterProject project, String gradle) async { Future<void> _buildGradleProjectV1(FlutterProject project, String gradle) async {
// Run 'gradlew build'. // Run 'gradlew build'.
final Status status = logger.startProgress( final Status status = logger.startProgress(
"Running 'gradlew build'...", "Running 'gradlew build'...",
...@@ -322,7 +322,7 @@ Future<Null> _buildGradleProjectV1(FlutterProject project, String gradle) async ...@@ -322,7 +322,7 @@ Future<Null> _buildGradleProjectV1(FlutterProject project, String gradle) async
printStatus('Built ${fs.path.relative(project.android.gradleAppOutV1File.path)}.'); printStatus('Built ${fs.path.relative(project.android.gradleAppOutV1File.path)}.');
} }
Future<Null> _buildGradleProjectV2( Future<void> _buildGradleProjectV2(
FlutterProject flutterProject, FlutterProject flutterProject,
String gradle, String gradle,
BuildInfo buildInfo, BuildInfo buildInfo,
......
...@@ -23,7 +23,7 @@ Future<List<int>> fetchUrl(Uri url) async { ...@@ -23,7 +23,7 @@ Future<List<int>> fetchUrl(Uri url) async {
if (result != null) if (result != null)
return result; return result;
printStatus('Download failed -- attempting retry $attempts in $duration second${ duration == 1 ? "" : "s"}...'); printStatus('Download failed -- attempting retry $attempts in $duration second${ duration == 1 ? "" : "s"}...');
await Future<Null>.delayed(Duration(seconds: duration)); await Future<void>.delayed(Duration(seconds: duration));
if (duration < 64) if (duration < 64)
duration *= 2; duration *= 2;
} }
......
...@@ -74,7 +74,7 @@ void addShutdownHook( ...@@ -74,7 +74,7 @@ void addShutdownHook(
/// hooks within a given stage will be started in parallel and will be /// hooks within a given stage will be started in parallel and will be
/// guaranteed to run to completion before shutdown hooks in the next stage are /// guaranteed to run to completion before shutdown hooks in the next stage are
/// started. /// started.
Future<Null> runShutdownHooks() async { Future<void> runShutdownHooks() async {
printTrace('Running shutdown hooks'); printTrace('Running shutdown hooks');
_shutdownHooksRunning = true; _shutdownHooksRunning = true;
try { try {
...@@ -164,12 +164,12 @@ Future<int> runCommandAndStreamOutput(List<String> cmd, { ...@@ -164,12 +164,12 @@ Future<int> runCommandAndStreamOutput(List<String> cmd, {
// Wait for stdout to be fully processed // Wait for stdout to be fully processed
// because process.exitCode may complete first causing flaky tests. // because process.exitCode may complete first causing flaky tests.
await waitGroup<Null>(<Future<Null>>[ await waitGroup<void>(<Future<void>>[
stdoutSubscription.asFuture<Null>(), stdoutSubscription.asFuture<void>(),
stderrSubscription.asFuture<Null>(), stderrSubscription.asFuture<void>(),
]); ]);
await waitGroup<Null>(<Future<Null>>[ await waitGroup<void>(<Future<void>>[
stdoutSubscription.cancel(), stdoutSubscription.cancel(),
stderrSubscription.cancel(), stderrSubscription.cancel(),
]); ]);
...@@ -203,9 +203,9 @@ Future<int> runInteractively(List<String> command, { ...@@ -203,9 +203,9 @@ Future<int> runInteractively(List<String> command, {
return await process.exitCode; return await process.exitCode;
} }
Future<Null> runAndKill(List<String> cmd, Duration timeout) { Future<void> runAndKill(List<String> cmd, Duration timeout) {
final Future<Process> proc = runDetached(cmd); final Future<Process> proc = runDetached(cmd);
return Future<Null>.delayed(timeout, () async { return Future<void>.delayed(timeout, () async {
printTrace('Intentionally killing ${cmd[0]}'); printTrace('Intentionally killing ${cmd[0]}');
processManager.killPid((await proc).pid); processManager.killPid((await proc).pid);
}); });
......
...@@ -251,14 +251,14 @@ Map<String, dynamic> castStringKeyedMap(dynamic untyped) { ...@@ -251,14 +251,14 @@ Map<String, dynamic> castStringKeyedMap(dynamic untyped) {
Clock get clock => context[Clock]; Clock get clock => context[Clock];
typedef AsyncCallback = Future<Null> Function(); typedef AsyncCallback = Future<void> Function();
/// A [Timer] inspired class that: /// A [Timer] inspired class that:
/// - has a different initial value for the first callback delay /// - has a different initial value for the first callback delay
/// - waits for a callback to be complete before it starts the next timer /// - waits for a callback to be complete before it starts the next timer
class Poller { class Poller {
Poller(this.callback, this.pollingInterval, { this.initialDelay = Duration.zero }) { Poller(this.callback, this.pollingInterval, { this.initialDelay = Duration.zero }) {
Future<Null>.delayed(initialDelay, _handleCallback); Future<void>.delayed(initialDelay, _handleCallback);
} }
final AsyncCallback callback; final AsyncCallback callback;
...@@ -268,7 +268,7 @@ class Poller { ...@@ -268,7 +268,7 @@ class Poller {
bool _cancelled = false; bool _cancelled = false;
Timer _timer; Timer _timer;
Future<Null> _handleCallback() async { Future<void> _handleCallback() async {
if (_cancelled) if (_cancelled)
return; return;
......
...@@ -70,7 +70,7 @@ class Cache { ...@@ -70,7 +70,7 @@ class Cache {
/// Normally the lock will be held until the process exits (this uses normal /// Normally the lock will be held until the process exits (this uses normal
/// POSIX flock semantics). Long-lived commands should release the lock by /// POSIX flock semantics). Long-lived commands should release the lock by
/// calling [Cache.releaseLockEarly] once they are no longer touching the cache. /// calling [Cache.releaseLockEarly] once they are no longer touching the cache.
static Future<Null> lock() async { static Future<void> lock() async {
if (!_lockEnabled) if (!_lockEnabled)
return null; return null;
assert(_lock == null); assert(_lock == null);
...@@ -87,7 +87,7 @@ class Cache { ...@@ -87,7 +87,7 @@ class Cache {
printStatus('Waiting for another flutter command to release the startup lock...'); printStatus('Waiting for another flutter command to release the startup lock...');
printed = true; printed = true;
} }
await Future<Null>.delayed(const Duration(milliseconds: 50)); await Future<void>.delayed(const Duration(milliseconds: 50));
} }
} }
} }
...@@ -199,7 +199,7 @@ class Cache { ...@@ -199,7 +199,7 @@ class Cache {
return cachedFile.path; return cachedFile.path;
} }
Future<Null> updateAll() async { Future<void> updateAll() async {
if (!_lockEnabled) if (!_lockEnabled)
return null; return null;
try { try {
...@@ -245,7 +245,7 @@ abstract class CachedArtifact { ...@@ -245,7 +245,7 @@ abstract class CachedArtifact {
return isUpToDateInner(); return isUpToDateInner();
} }
Future<Null> update() async { Future<void> update() async {
if (location.existsSync()) if (location.existsSync())
location.deleteSync(recursive: true); location.deleteSync(recursive: true);
location.createSync(recursive: true); location.createSync(recursive: true);
...@@ -272,7 +272,7 @@ abstract class CachedArtifact { ...@@ -272,7 +272,7 @@ abstract class CachedArtifact {
bool isUpToDateInner() => true; bool isUpToDateInner() => true;
/// Template method to perform artifact update. /// Template method to perform artifact update.
Future<Null> updateInner(); Future<void> updateInner();
String get _storageBaseUrl { String get _storageBaseUrl {
final String overrideUrl = platform.environment['FLUTTER_STORAGE_BASE_URL']; final String overrideUrl = platform.environment['FLUTTER_STORAGE_BASE_URL'];
...@@ -285,7 +285,7 @@ abstract class CachedArtifact { ...@@ -285,7 +285,7 @@ abstract class CachedArtifact {
Uri _toStorageUri(String path) => Uri.parse('$_storageBaseUrl/$path'); Uri _toStorageUri(String path) => Uri.parse('$_storageBaseUrl/$path');
/// Download an archive from the given [url] and unzip it to [location]. /// Download an archive from the given [url] and unzip it to [location].
Future<Null> _downloadArchive(String message, Uri url, Directory location, bool verifier(File f), void extractor(File f, Directory d)) { Future<void> _downloadArchive(String message, Uri url, Directory location, bool verifier(File f), void extractor(File f, Directory d)) {
return _withDownloadFile('${flattenNameSubdirs(url)}', (File tempFile) async { return _withDownloadFile('${flattenNameSubdirs(url)}', (File tempFile) async {
if (!verifier(tempFile)) { if (!verifier(tempFile)) {
final Status status = logger.startProgress(message, expectSlowOperation: true); final Status status = logger.startProgress(message, expectSlowOperation: true);
...@@ -305,18 +305,18 @@ abstract class CachedArtifact { ...@@ -305,18 +305,18 @@ abstract class CachedArtifact {
} }
/// Download a zip archive from the given [url] and unzip it to [location]. /// Download a zip archive from the given [url] and unzip it to [location].
Future<Null> _downloadZipArchive(String message, Uri url, Directory location) { Future<void> _downloadZipArchive(String message, Uri url, Directory location) {
return _downloadArchive(message, url, location, os.verifyZip, os.unzip); return _downloadArchive(message, url, location, os.verifyZip, os.unzip);
} }
/// Download a gzipped tarball from the given [url] and unpack it to [location]. /// Download a gzipped tarball from the given [url] and unpack it to [location].
Future<Null> _downloadZippedTarball(String message, Uri url, Directory location) { Future<void> _downloadZippedTarball(String message, Uri url, Directory location) {
return _downloadArchive(message, url, location, os.verifyGzip, os.unpack); return _downloadArchive(message, url, location, os.verifyGzip, os.unpack);
} }
/// Create a temporary file and invoke [onTemporaryFile] with the file as /// Create a temporary file and invoke [onTemporaryFile] with the file as
/// argument, then add the temporary file to the [_downloadedFiles]. /// argument, then add the temporary file to the [_downloadedFiles].
Future<Null> _withDownloadFile(String name, Future<Null> onTemporaryFile(File file)) async { Future<void> _withDownloadFile(String name, Future<void> onTemporaryFile(File file)) async {
final File tempFile = fs.file(fs.path.join(cache.getDownloadDir().path, name)); final File tempFile = fs.file(fs.path.join(cache.getDownloadDir().path, name));
_downloadedFiles.add(tempFile); _downloadedFiles.add(tempFile);
await onTemporaryFile(tempFile); await onTemporaryFile(tempFile);
...@@ -340,7 +340,7 @@ class MaterialFonts extends CachedArtifact { ...@@ -340,7 +340,7 @@ class MaterialFonts extends CachedArtifact {
MaterialFonts(Cache cache): super('material_fonts', cache); MaterialFonts(Cache cache): super('material_fonts', cache);
@override @override
Future<Null> updateInner() { Future<void> updateInner() {
final Uri archiveUri = _toStorageUri(version); final Uri archiveUri = _toStorageUri(version);
return _downloadZipArchive('Downloading Material fonts...', archiveUri, location); return _downloadZipArchive('Downloading Material fonts...', archiveUri, location);
} }
...@@ -470,7 +470,7 @@ class FlutterEngine extends CachedArtifact { ...@@ -470,7 +470,7 @@ class FlutterEngine extends CachedArtifact {
} }
@override @override
Future<Null> updateInner() async { Future<void> updateInner() async {
final String url = '$_storageBaseUrl/flutter_infra/flutter/$version/'; final String url = '$_storageBaseUrl/flutter_infra/flutter/$version/';
final Directory pkgDir = cache.getCacheDir('pkg'); final Directory pkgDir = cache.getCacheDir('pkg');
...@@ -521,9 +521,9 @@ class GradleWrapper extends CachedArtifact { ...@@ -521,9 +521,9 @@ class GradleWrapper extends CachedArtifact {
GradleWrapper(Cache cache): super('gradle_wrapper', cache); GradleWrapper(Cache cache): super('gradle_wrapper', cache);
@override @override
Future<Null> updateInner() { Future<void> updateInner() {
final Uri archiveUri = _toStorageUri(version); final Uri archiveUri = _toStorageUri(version);
return _downloadZippedTarball('Downloading Gradle Wrapper...', archiveUri, location).then<Null>((_) { return _downloadZippedTarball('Downloading Gradle Wrapper...', archiveUri, location).then<void>((_) {
// Delete property file, allowing templates to provide it. // Delete property file, allowing templates to provide it.
fs.file(fs.path.join(location.path, 'gradle', 'wrapper', 'gradle-wrapper.properties')).deleteSync(); fs.file(fs.path.join(location.path, 'gradle', 'wrapper', 'gradle-wrapper.properties')).deleteSync();
// Remove NOTICE file. Should not be part of the template. // Remove NOTICE file. Should not be part of the template.
...@@ -565,7 +565,7 @@ String flattenNameSubdirs(Uri url) { ...@@ -565,7 +565,7 @@ String flattenNameSubdirs(Uri url) {
} }
/// Download a file from the given [url] and write it to [location]. /// Download a file from the given [url] and write it to [location].
Future<Null> _downloadFile(Uri url, File location) async { Future<void> _downloadFile(Uri url, File location) async {
_ensureExists(location.parent); _ensureExists(location.parent);
final List<int> fileBytes = await fetchUrl(url); final List<int> fileBytes = await fetchUrl(url);
location.writeAsBytesSync(fileBytes, flush: true); location.writeAsBytesSync(fileBytes, flush: true);
......
...@@ -80,20 +80,22 @@ class AnalyzeCommand extends FlutterCommand { ...@@ -80,20 +80,22 @@ class AnalyzeCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() { Future<FlutterCommandResult> runCommand() async {
if (argResults['watch']) { if (argResults['watch']) {
return AnalyzeContinuously( await AnalyzeContinuously(
argResults, argResults,
runner.getRepoRoots(), runner.getRepoRoots(),
runner.getRepoPackages(), runner.getRepoPackages(),
).analyze(); ).analyze();
return null;
} else { } else {
return AnalyzeOnce( await AnalyzeOnce(
argResults, argResults,
runner.getRepoRoots(), runner.getRepoRoots(),
runner.getRepoPackages(), runner.getRepoPackages(),
workingDirectory: workingDirectory, workingDirectory: workingDirectory,
).analyze(); ).analyze();
return null;
} }
} }
} }
...@@ -21,7 +21,7 @@ abstract class AnalyzeBase { ...@@ -21,7 +21,7 @@ abstract class AnalyzeBase {
final ArgResults argResults; final ArgResults argResults;
/// Called by [AnalyzeCommand] to start the analysis process. /// Called by [AnalyzeCommand] to start the analysis process.
Future<Null> analyze(); Future<void> analyze();
void dumpErrors(Iterable<String> errors) { void dumpErrors(Iterable<String> errors) {
if (argResults['write'] != null) { if (argResults['write'] != null) {
......
...@@ -33,7 +33,7 @@ class AnalyzeContinuously extends AnalyzeBase { ...@@ -33,7 +33,7 @@ class AnalyzeContinuously extends AnalyzeBase {
Status analysisStatus; Status analysisStatus;
@override @override
Future<Null> analyze() async { Future<void> analyze() async {
List<String> directories; List<String> directories;
if (argResults['flutter-repo']) { if (argResults['flutter-repo']) {
......
...@@ -33,7 +33,7 @@ class AnalyzeOnce extends AnalyzeBase { ...@@ -33,7 +33,7 @@ class AnalyzeOnce extends AnalyzeBase {
final Directory workingDirectory; final Directory workingDirectory;
@override @override
Future<Null> analyze() async { Future<void> analyze() async {
final String currentDirectory = final String currentDirectory =
(workingDirectory ?? fs.currentDirectory).path; (workingDirectory ?? fs.currentDirectory).path;
...@@ -68,7 +68,7 @@ class AnalyzeOnce extends AnalyzeBase { ...@@ -68,7 +68,7 @@ class AnalyzeOnce extends AnalyzeBase {
throwToolExit('Nothing to analyze.', exitCode: 0); throwToolExit('Nothing to analyze.', exitCode: 0);
// analyze all // analyze all
final Completer<Null> analysisCompleter = Completer<Null>(); final Completer<void> analysisCompleter = Completer<void>();
final List<AnalysisError> errors = <AnalysisError>[]; final List<AnalysisError> errors = <AnalysisError>[];
final String sdkPath = argResults['dart-sdk'] ?? sdk.dartSdkPath; final String sdkPath = argResults['dart-sdk'] ?? sdk.dartSdkPath;
......
...@@ -76,7 +76,7 @@ class AttachCommand extends FlutterCommand { ...@@ -76,7 +76,7 @@ class AttachCommand extends FlutterCommand {
} }
@override @override
Future<Null> validateCommand() async { Future<void> validateCommand() async {
await super.validateCommand(); await super.validateCommand();
if (await findTargetDevice() == null) if (await findTargetDevice() == null)
throwToolExit(null); throwToolExit(null);
...@@ -84,7 +84,7 @@ class AttachCommand extends FlutterCommand { ...@@ -84,7 +84,7 @@ class AttachCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
Cache.releaseLockEarly(); Cache.releaseLockEarly();
await _validateArguments(); await _validateArguments();
...@@ -152,6 +152,7 @@ class AttachCommand extends FlutterCommand { ...@@ -152,6 +152,7 @@ class AttachCommand extends FlutterCommand {
final List<ForwardedPort> ports = device.portForwarder.forwardedPorts.toList(); final List<ForwardedPort> ports = device.portForwarder.forwardedPorts.toList();
ports.forEach(device.portForwarder.unforward); ports.forEach(device.portForwarder.unforward);
} }
return null;
} }
Future<void> _validateArguments() async {} Future<void> _validateArguments() async {}
......
...@@ -32,7 +32,7 @@ class BuildCommand extends FlutterCommand { ...@@ -32,7 +32,7 @@ class BuildCommand extends FlutterCommand {
final String description = 'Flutter build commands.'; final String description = 'Flutter build commands.';
@override @override
Future<Null> runCommand() async { } Future<FlutterCommandResult> runCommand() async => null;
} }
abstract class BuildSubCommand extends FlutterCommand { abstract class BuildSubCommand extends FlutterCommand {
...@@ -42,7 +42,7 @@ abstract class BuildSubCommand extends FlutterCommand { ...@@ -42,7 +42,7 @@ abstract class BuildSubCommand extends FlutterCommand {
@override @override
@mustCallSuper @mustCallSuper
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (isRunningOnBot) { if (isRunningOnBot) {
final File dotPackages = fs.file('.packages'); final File dotPackages = fs.file('.packages');
printStatus('Contents of .packages:'); printStatus('Contents of .packages:');
...@@ -58,5 +58,6 @@ abstract class BuildSubCommand extends FlutterCommand { ...@@ -58,5 +58,6 @@ abstract class BuildSubCommand extends FlutterCommand {
else else
printError('File not found: ${pubspecLock.absolute.path}'); printError('File not found: ${pubspecLock.absolute.path}');
} }
return null;
} }
} }
...@@ -56,7 +56,7 @@ class BuildAotCommand extends BuildSubCommand { ...@@ -56,7 +56,7 @@ class BuildAotCommand extends BuildSubCommand {
final String description = "Build an ahead-of-time compiled snapshot of your app's Dart code."; final String description = "Build an ahead-of-time compiled snapshot of your app's Dart code.";
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
await super.runCommand(); await super.runCommand();
final String targetPlatform = argResults['target-platform']; final String targetPlatform = argResults['target-platform'];
...@@ -89,7 +89,7 @@ class BuildAotCommand extends BuildSubCommand { ...@@ -89,7 +89,7 @@ class BuildAotCommand extends BuildSubCommand {
); );
if (mainPath == null) { if (mainPath == null) {
throwToolExit('Compiler terminated unexpectedly.'); throwToolExit('Compiler terminated unexpectedly.');
return; return null;
} }
// Build AOT snapshot. // Build AOT snapshot.
...@@ -152,7 +152,7 @@ class BuildAotCommand extends BuildSubCommand { ...@@ -152,7 +152,7 @@ class BuildAotCommand extends BuildSubCommand {
// Catch the String exceptions thrown from the `runCheckedSync` methods below. // Catch the String exceptions thrown from the `runCheckedSync` methods below.
status?.cancel(); status?.cancel();
printError(error); printError(error);
return; return null;
} }
status?.stop(); status?.stop();
...@@ -165,5 +165,6 @@ class BuildAotCommand extends BuildSubCommand { ...@@ -165,5 +165,6 @@ class BuildAotCommand extends BuildSubCommand {
} else { } else {
printStatus(builtMessage); printStatus(builtMessage);
} }
return null;
} }
} }
...@@ -6,6 +6,7 @@ import 'dart:async'; ...@@ -6,6 +6,7 @@ import 'dart:async';
import '../android/apk.dart'; import '../android/apk.dart';
import '../project.dart'; import '../project.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult;
import 'build.dart'; import 'build.dart';
class BuildApkCommand extends BuildSubCommand { class BuildApkCommand extends BuildSubCommand {
...@@ -38,12 +39,13 @@ class BuildApkCommand extends BuildSubCommand { ...@@ -38,12 +39,13 @@ class BuildApkCommand extends BuildSubCommand {
'suitable for deploying to app stores.'; 'suitable for deploying to app stores.';
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
await super.runCommand(); await super.runCommand();
await buildApk( await buildApk(
project: await FlutterProject.current(), project: await FlutterProject.current(),
target: targetFile, target: targetFile,
buildInfo: getBuildInfo(), buildInfo: getBuildInfo(),
); );
return null;
} }
} }
...@@ -7,7 +7,7 @@ import 'dart:async'; ...@@ -7,7 +7,7 @@ import 'dart:async';
import '../base/common.dart'; import '../base/common.dart';
import '../build_info.dart'; import '../build_info.dart';
import '../bundle.dart'; import '../bundle.dart';
import '../runner/flutter_command.dart' show FlutterOptions; import '../runner/flutter_command.dart' show FlutterOptions, FlutterCommandResult;
import 'build.dart'; import 'build.dart';
class BuildBundleCommand extends BuildSubCommand { class BuildBundleCommand extends BuildSubCommand {
...@@ -78,7 +78,7 @@ class BuildBundleCommand extends BuildSubCommand { ...@@ -78,7 +78,7 @@ class BuildBundleCommand extends BuildSubCommand {
' iOS runtimes.'; ' iOS runtimes.';
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
await super.runCommand(); await super.runCommand();
final String targetPlatform = argResults['target-platform']; final String targetPlatform = argResults['target-platform'];
...@@ -108,5 +108,6 @@ class BuildBundleCommand extends BuildSubCommand { ...@@ -108,5 +108,6 @@ class BuildBundleCommand extends BuildSubCommand {
fileSystemScheme: argResults['filesystem-scheme'], fileSystemScheme: argResults['filesystem-scheme'],
fileSystemRoots: argResults['filesystem-root'], fileSystemRoots: argResults['filesystem-root'],
); );
return null;
} }
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'dart:async'; import 'dart:async';
import '../globals.dart'; import '../globals.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult;
import 'build.dart'; import 'build.dart';
class BuildFlxCommand extends BuildSubCommand { class BuildFlxCommand extends BuildSubCommand {
...@@ -18,11 +19,13 @@ class BuildFlxCommand extends BuildSubCommand { ...@@ -18,11 +19,13 @@ class BuildFlxCommand extends BuildSubCommand {
final String usageFooter = 'FLX archives are deprecated.'; final String usageFooter = 'FLX archives are deprecated.';
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
await super.runCommand(); await super.runCommand();
printError("'build flx' is no longer supported. Instead, use 'build " printError("'build flx' is no longer supported. Instead, use 'build "
"bundle' to build and assemble the application code and resources " "bundle' to build and assemble the application code and resources "
'for your app.'); 'for your app.');
return null;
} }
} }
...@@ -10,6 +10,7 @@ import '../base/utils.dart'; ...@@ -10,6 +10,7 @@ import '../base/utils.dart';
import '../build_info.dart'; import '../build_info.dart';
import '../globals.dart'; import '../globals.dart';
import '../ios/mac.dart'; import '../ios/mac.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult;
import 'build.dart'; import 'build.dart';
class BuildIOSCommand extends BuildSubCommand { class BuildIOSCommand extends BuildSubCommand {
...@@ -48,7 +49,7 @@ class BuildIOSCommand extends BuildSubCommand { ...@@ -48,7 +49,7 @@ class BuildIOSCommand extends BuildSubCommand {
final String description = 'Build an iOS application bundle (Mac OS X host only).'; final String description = 'Build an iOS application bundle (Mac OS X host only).';
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final bool forSimulator = argResults['simulator']; final bool forSimulator = argResults['simulator'];
defaultBuildMode = forSimulator ? BuildMode.debug : BuildMode.release; defaultBuildMode = forSimulator ? BuildMode.debug : BuildMode.release;
...@@ -90,5 +91,7 @@ class BuildIOSCommand extends BuildSubCommand { ...@@ -90,5 +91,7 @@ class BuildIOSCommand extends BuildSubCommand {
if (result.output != null) if (result.output != null)
printStatus('Built ${result.output}.'); printStatus('Built ${result.output}.');
return null;
} }
} }
...@@ -32,18 +32,20 @@ class ChannelCommand extends FlutterCommand { ...@@ -32,18 +32,20 @@ class ChannelCommand extends FlutterCommand {
String get invocation => '${runner.executableName} $name [<channel-name>]'; String get invocation => '${runner.executableName} $name [<channel-name>]';
@override @override
Future<Null> runCommand() { Future<FlutterCommandResult> runCommand() async {
switch (argResults.rest.length) { switch (argResults.rest.length) {
case 0: case 0:
return _listChannels(showAll: argResults['all']); await _listChannels(showAll: argResults['all']);
return null;
case 1: case 1:
return _switchChannel(argResults.rest[0]); await _switchChannel(argResults.rest[0]);
return null;
default: default:
throw ToolExit('Too many arguments.\n$usage'); throw ToolExit('Too many arguments.\n$usage');
} }
} }
Future<Null> _listChannels({ bool showAll }) async { Future<void> _listChannels({ bool showAll }) async {
// Beware: currentBranch could contain PII. See getBranchName(). // Beware: currentBranch could contain PII. See getBranchName().
final String currentChannel = FlutterVersion.instance.channel; final String currentChannel = FlutterVersion.instance.channel;
final String currentBranch = FlutterVersion.instance.getBranchName(); final String currentBranch = FlutterVersion.instance.getBranchName();
...@@ -76,7 +78,7 @@ class ChannelCommand extends FlutterCommand { ...@@ -76,7 +78,7 @@ class ChannelCommand extends FlutterCommand {
throwToolExit('List channels failed: $result', exitCode: result); throwToolExit('List channels failed: $result', exitCode: result);
} }
Future<Null> _switchChannel(String branchName) { Future<void> _switchChannel(String branchName) {
printStatus("Switching to flutter channel '$branchName'..."); printStatus("Switching to flutter channel '$branchName'...");
if (FlutterVersion.obsoleteBranches.containsKey(branchName)) { if (FlutterVersion.obsoleteBranches.containsKey(branchName)) {
final String alternative = FlutterVersion.obsoleteBranches[branchName]; final String alternative = FlutterVersion.obsoleteBranches[branchName];
...@@ -87,7 +89,7 @@ class ChannelCommand extends FlutterCommand { ...@@ -87,7 +89,7 @@ class ChannelCommand extends FlutterCommand {
return _checkout(branchName); return _checkout(branchName);
} }
static Future<Null> upgradeChannel() async { static Future<void> upgradeChannel() async {
final String channel = FlutterVersion.instance.channel; final String channel = FlutterVersion.instance.channel;
if (FlutterVersion.obsoleteBranches.containsKey(channel)) { if (FlutterVersion.obsoleteBranches.containsKey(channel)) {
final String alternative = FlutterVersion.obsoleteBranches[channel]; final String alternative = FlutterVersion.obsoleteBranches[channel];
...@@ -96,7 +98,7 @@ class ChannelCommand extends FlutterCommand { ...@@ -96,7 +98,7 @@ class ChannelCommand extends FlutterCommand {
} }
} }
static Future<Null> _checkout(String branchName) async { static Future<void> _checkout(String branchName) async {
// Get latest refs from upstream. // Get latest refs from upstream.
int result = await runCommandAndStreamOutput( int result = await runCommandAndStreamOutput(
<String>['git', 'fetch'], <String>['git', 'fetch'],
......
...@@ -22,17 +22,19 @@ class CleanCommand extends FlutterCommand { ...@@ -22,17 +22,19 @@ class CleanCommand extends FlutterCommand {
final String description = 'Delete the build/ directory.'; final String description = 'Delete the build/ directory.';
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final Directory buildDir = fs.directory(getBuildDirectory()); final Directory buildDir = fs.directory(getBuildDirectory());
printStatus("Deleting '${buildDir.path}${fs.path.separator}'."); printStatus("Deleting '${buildDir.path}${fs.path.separator}'.");
if (!buildDir.existsSync()) if (!buildDir.existsSync())
return; return null;
try { try {
buildDir.deleteSync(recursive: true); buildDir.deleteSync(recursive: true);
} catch (error) { } catch (error) {
throwToolExit(error.toString()); throwToolExit(error.toString());
} }
return null;
} }
} }
...@@ -62,9 +62,11 @@ class ConfigCommand extends FlutterCommand { ...@@ -62,9 +62,11 @@ class ConfigCommand extends FlutterCommand {
Future<String> get usagePath => null; Future<String> get usagePath => null;
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (argResults['machine']) if (argResults['machine']) {
return handleMachine(); await handleMachine();
return null;
}
if (argResults.wasParsed('analytics')) { if (argResults.wasParsed('analytics')) {
final bool value = argResults['analytics']; final bool value = argResults['analytics'];
...@@ -86,9 +88,11 @@ class ConfigCommand extends FlutterCommand { ...@@ -86,9 +88,11 @@ class ConfigCommand extends FlutterCommand {
if (argResults.arguments.isEmpty) if (argResults.arguments.isEmpty)
printStatus(usage); printStatus(usage);
return null;
} }
Future<Null> handleMachine() async { Future<void> handleMachine() async {
// Get all the current values. // Get all the current values.
final Map<String, dynamic> results = <String, dynamic>{}; final Map<String, dynamic> results = <String, dynamic>{};
for (String key in config.keys) { for (String key in config.keys) {
......
...@@ -171,7 +171,7 @@ class CreateCommand extends FlutterCommand { ...@@ -171,7 +171,7 @@ class CreateCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (argResults.rest.isEmpty) if (argResults.rest.isEmpty)
throwToolExit('No option specified for the output directory.\n$usage', exitCode: 2); throwToolExit('No option specified for the output directory.\n$usage', exitCode: 2);
...@@ -334,6 +334,8 @@ To edit platform code in an IDE see https://flutter.io/developing-packages/#edit ...@@ -334,6 +334,8 @@ To edit platform code in an IDE see https://flutter.io/developing-packages/#edit
printStatus('Your application code is in $relativeAppMain'); printStatus('Your application code is in $relativeAppMain');
} }
} }
return null;
} }
Future<int> _generateApplication(Directory directory, Map<String, dynamic> templateContext) async { Future<int> _generateApplication(Directory directory, Map<String, dynamic> templateContext) async {
......
...@@ -50,14 +50,14 @@ class DaemonCommand extends FlutterCommand { ...@@ -50,14 +50,14 @@ class DaemonCommand extends FlutterCommand {
final bool hidden; final bool hidden;
@override @override
Future<Null> runCommand() { Future<FlutterCommandResult> runCommand() async {
printStatus('Starting device daemon...'); printStatus('Starting device daemon...');
final NotifyingLogger notifyingLogger = NotifyingLogger(); final NotifyingLogger notifyingLogger = NotifyingLogger();
Cache.releaseLockEarly(); Cache.releaseLockEarly();
return context.run<Null>( await context.run<void>(
body: () async { body: () async {
final Daemon daemon = Daemon( final Daemon daemon = Daemon(
stdinCommandStream, stdoutCommandResponse, stdinCommandStream, stdoutCommandResponse,
...@@ -71,6 +71,7 @@ class DaemonCommand extends FlutterCommand { ...@@ -71,6 +71,7 @@ class DaemonCommand extends FlutterCommand {
Logger: () => notifyingLogger, Logger: () => notifyingLogger,
}, },
); );
return null;
} }
} }
...@@ -295,9 +296,9 @@ class DaemonDomain extends Domain { ...@@ -295,9 +296,9 @@ class DaemonDomain extends Domain {
return Future<String>.value(protocolVersion); return Future<String>.value(protocolVersion);
} }
Future<Null> shutdown(Map<String, dynamic> args) { Future<void> shutdown(Map<String, dynamic> args) {
Timer.run(daemon.shutdown); Timer.run(daemon.shutdown);
return Future<Null>.value(); return Future<void>.value();
} }
@override @override
...@@ -413,7 +414,7 @@ class AppDomain extends Domain { ...@@ -413,7 +414,7 @@ class AppDomain extends Domain {
connectionInfoCompleter = Completer<DebugConnectionInfo>(); connectionInfoCompleter = Completer<DebugConnectionInfo>();
// We don't want to wait for this future to complete and callbacks won't fail. // We don't want to wait for this future to complete and callbacks won't fail.
// As it just writes to stdout. // As it just writes to stdout.
connectionInfoCompleter.future.then<Null>((DebugConnectionInfo info) { // ignore: unawaited_futures connectionInfoCompleter.future.then<void>((DebugConnectionInfo info) { // ignore: unawaited_futures
final Map<String, dynamic> params = <String, dynamic>{ final Map<String, dynamic> params = <String, dynamic>{
'port': info.httpUri.port, 'port': info.httpUri.port,
'wsUri': info.wsUri.toString(), 'wsUri': info.wsUri.toString(),
...@@ -435,7 +436,7 @@ class AppDomain extends Domain { ...@@ -435,7 +436,7 @@ class AppDomain extends Domain {
_sendAppEvent(app, 'started'); _sendAppEvent(app, 'started');
}); });
await app._runInZone<Null>(this, () async { await app._runInZone<void>(this, () async {
try { try {
await runOrAttach( await runOrAttach(
connectionInfoCompleter: connectionInfoCompleter, connectionInfoCompleter: connectionInfoCompleter,
...@@ -599,11 +600,11 @@ class DeviceDomain extends Domain { ...@@ -599,11 +600,11 @@ class DeviceDomain extends Domain {
discoverer.onRemoved.listen(_onDeviceEvent('device.removed')); discoverer.onRemoved.listen(_onDeviceEvent('device.removed'));
} }
Future<Null> _serializeDeviceEvents = Future<Null>.value(); Future<void> _serializeDeviceEvents = Future<void>.value();
_DeviceEventHandler _onDeviceEvent(String eventName) { _DeviceEventHandler _onDeviceEvent(String eventName) {
return (Device device) { return (Device device) {
_serializeDeviceEvents = _serializeDeviceEvents.then<Null>((_) async { _serializeDeviceEvents = _serializeDeviceEvents.then<void>((_) async {
sendEvent(eventName, await _deviceToMap(device)); sendEvent(eventName, await _deviceToMap(device));
}); });
}; };
...@@ -620,17 +621,17 @@ class DeviceDomain extends Domain { ...@@ -620,17 +621,17 @@ class DeviceDomain extends Domain {
} }
/// Enable device events. /// Enable device events.
Future<Null> enable(Map<String, dynamic> args) { Future<void> enable(Map<String, dynamic> args) {
for (PollingDeviceDiscovery discoverer in _discoverers) for (PollingDeviceDiscovery discoverer in _discoverers)
discoverer.startPolling(); discoverer.startPolling();
return Future<Null>.value(); return Future<void>.value();
} }
/// Disable device events. /// Disable device events.
Future<Null> disable(Map<String, dynamic> args) { Future<void> disable(Map<String, dynamic> args) {
for (PollingDeviceDiscovery discoverer in _discoverers) for (PollingDeviceDiscovery discoverer in _discoverers)
discoverer.stopPolling(); discoverer.stopPolling();
return Future<Null>.value(); return Future<void>.value();
} }
/// Forward a host port to a device port. /// Forward a host port to a device port.
...@@ -649,7 +650,7 @@ class DeviceDomain extends Domain { ...@@ -649,7 +650,7 @@ class DeviceDomain extends Domain {
} }
/// Removes a forwarded port. /// Removes a forwarded port.
Future<Null> unforward(Map<String, dynamic> args) async { Future<void> unforward(Map<String, dynamic> args) async {
final String deviceId = _getStringArg(args, 'deviceId', required: true); final String deviceId = _getStringArg(args, 'deviceId', required: true);
final int devicePort = _getIntArg(args, 'devicePort', required: true); final int devicePort = _getIntArg(args, 'devicePort', required: true);
final int hostPort = _getIntArg(args, 'hostPort', required: true); final int hostPort = _getIntArg(args, 'hostPort', required: true);
...@@ -798,8 +799,8 @@ class AppInstance { ...@@ -798,8 +799,8 @@ class AppInstance {
return runner.restart(fullRestart: fullRestart, pauseAfterRestart: pauseAfterRestart); return runner.restart(fullRestart: fullRestart, pauseAfterRestart: pauseAfterRestart);
} }
Future<Null> stop() => runner.stop(); Future<void> stop() => runner.stop();
Future<Null> detach() => runner.detach(); Future<void> detach() => runner.detach();
void closeLogger() { void closeLogger() {
_logger.close(); _logger.close();
...@@ -832,7 +833,7 @@ class EmulatorDomain extends Domain { ...@@ -832,7 +833,7 @@ class EmulatorDomain extends Domain {
return list.map<Map<String, dynamic>>(_emulatorToMap).toList(); return list.map<Map<String, dynamic>>(_emulatorToMap).toList();
} }
Future<Null> launch(Map<String, dynamic> args) async { Future<void> launch(Map<String, dynamic> args) async {
final String emulatorId = _getStringArg(args, 'emulatorId', required: true); final String emulatorId = _getStringArg(args, 'emulatorId', required: true);
final List<Emulator> matches = final List<Emulator> matches =
await emulators.getEmulatorsMatching(emulatorId); await emulators.getEmulatorsMatching(emulatorId);
......
...@@ -19,7 +19,7 @@ class DevicesCommand extends FlutterCommand { ...@@ -19,7 +19,7 @@ class DevicesCommand extends FlutterCommand {
final String description = 'List all connected devices.'; final String description = 'List all connected devices.';
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (!doctor.canListAnything) { if (!doctor.canListAnything) {
throwToolExit( throwToolExit(
"Unable to locate a development device; please run 'flutter doctor' for " "Unable to locate a development device; please run 'flutter doctor' for "
...@@ -46,5 +46,7 @@ class DevicesCommand extends FlutterCommand { ...@@ -46,5 +46,7 @@ class DevicesCommand extends FlutterCommand {
printStatus('${devices.length} connected ${pluralize('device', devices.length)}:\n'); printStatus('${devices.length} connected ${pluralize('device', devices.length)}:\n');
await Device.printDevices(devices); await Device.printDevices(devices);
} }
return null;
} }
} }
...@@ -14,6 +14,7 @@ import '../dart/sdk.dart'; ...@@ -14,6 +14,7 @@ import '../dart/sdk.dart';
import '../device.dart'; import '../device.dart';
import '../globals.dart'; import '../globals.dart';
import '../resident_runner.dart'; import '../resident_runner.dart';
import '../runner/flutter_command.dart' show FlutterCommandResult;
import 'run.dart'; import 'run.dart';
/// Runs integration (a.k.a. end-to-end) tests. /// Runs integration (a.k.a. end-to-end) tests.
...@@ -82,7 +83,7 @@ class DriveCommand extends RunCommandBase { ...@@ -82,7 +83,7 @@ class DriveCommand extends RunCommandBase {
StreamSubscription<String> _deviceLogSubscription; StreamSubscription<String> _deviceLogSubscription;
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final String testFile = _getTestFile(); final String testFile = _getTestFile();
if (testFile == null) if (testFile == null)
throwToolExit(null); throwToolExit(null);
...@@ -133,6 +134,8 @@ class DriveCommand extends RunCommandBase { ...@@ -133,6 +134,8 @@ class DriveCommand extends RunCommandBase {
await appStopper(this); await appStopper(this);
} }
} }
return null;
} }
String _getTestFile() { String _getTestFile() {
...@@ -272,13 +275,13 @@ Future<LaunchResult> _startApp(DriveCommand command) async { ...@@ -272,13 +275,13 @@ Future<LaunchResult> _startApp(DriveCommand command) async {
} }
/// Runs driver tests. /// Runs driver tests.
typedef TestRunner = Future<Null> Function(List<String> testArgs, String observatoryUri); typedef TestRunner = Future<void> Function(List<String> testArgs, String observatoryUri);
TestRunner testRunner = _runTests; TestRunner testRunner = _runTests;
void restoreTestRunner() { void restoreTestRunner() {
testRunner = _runTests; testRunner = _runTests;
} }
Future<Null> _runTests(List<String> testArgs, String observatoryUri) async { Future<void> _runTests(List<String> testArgs, String observatoryUri) async {
printTrace('Running driver tests.'); printTrace('Running driver tests.');
PackageMap.globalPackagesPath = fs.path.normalize(fs.path.absolute(PackageMap.globalPackagesPath)); PackageMap.globalPackagesPath = fs.path.normalize(fs.path.absolute(PackageMap.globalPackagesPath));
......
...@@ -33,7 +33,7 @@ class EmulatorsCommand extends FlutterCommand { ...@@ -33,7 +33,7 @@ class EmulatorsCommand extends FlutterCommand {
final List<String> aliases = <String>['emulator']; final List<String> aliases = <String>['emulator'];
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (doctor.workflows.every((Workflow w) => !w.canListEmulators)) { if (doctor.workflows.every((Workflow w) => !w.canListEmulators)) {
throwToolExit( throwToolExit(
'Unable to find any emulator sources. Please ensure you have some\n' 'Unable to find any emulator sources. Please ensure you have some\n'
...@@ -54,6 +54,8 @@ class EmulatorsCommand extends FlutterCommand { ...@@ -54,6 +54,8 @@ class EmulatorsCommand extends FlutterCommand {
: null; : null;
await _listEmulators(searchText); await _listEmulators(searchText);
} }
return null;
} }
Future<void> _launchEmulator(String id) async { Future<void> _launchEmulator(String id) async {
...@@ -81,7 +83,7 @@ class EmulatorsCommand extends FlutterCommand { ...@@ -81,7 +83,7 @@ class EmulatorsCommand extends FlutterCommand {
} }
} }
Future<Null> _createEmulator({String name}) async { Future<void> _createEmulator({String name}) async {
final CreateEmulatorResult createResult = final CreateEmulatorResult createResult =
await emulatorManager.createEmulator(name: name); await emulatorManager.createEmulator(name: name);
......
...@@ -43,7 +43,7 @@ class FormatCommand extends FlutterCommand { ...@@ -43,7 +43,7 @@ class FormatCommand extends FlutterCommand {
String get invocation => '${runner.executableName} $name <one or more paths>'; String get invocation => '${runner.executableName} $name <one or more paths>';
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (argResults.rest.isEmpty) { if (argResults.rest.isEmpty) {
throwToolExit( throwToolExit(
'No files specified to be formatted.\n' 'No files specified to be formatted.\n'
...@@ -77,5 +77,7 @@ class FormatCommand extends FlutterCommand { ...@@ -77,5 +77,7 @@ class FormatCommand extends FlutterCommand {
final int result = await runCommandAndStreamOutput(command); final int result = await runCommandAndStreamOutput(command);
if (result != 0) if (result != 0)
throwToolExit('Formatting failed: $result', exitCode: result); throwToolExit('Formatting failed: $result', exitCode: result);
return null;
} }
} }
...@@ -102,7 +102,7 @@ class FuchsiaReloadCommand extends FlutterCommand { ...@@ -102,7 +102,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
bool _list; bool _list;
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
Cache.releaseLockEarly(); Cache.releaseLockEarly();
await _validateArguments(); await _validateArguments();
...@@ -130,7 +130,7 @@ class FuchsiaReloadCommand extends FlutterCommand { ...@@ -130,7 +130,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
// continue to work. // continue to work.
printStatus('Press Enter to exit.'); printStatus('Press Enter to exit.');
await stdin.first; await stdin.first;
return; return null;
} }
// Check that there are running VM services on the returned // Check that there are running VM services on the returned
...@@ -168,8 +168,10 @@ class FuchsiaReloadCommand extends FlutterCommand { ...@@ -168,8 +168,10 @@ class FuchsiaReloadCommand extends FlutterCommand {
printStatus('Connecting to $_modName'); printStatus('Connecting to $_modName');
await hotRunner.attach(viewFilter: isolateName); await hotRunner.attach(viewFilter: isolateName);
} finally { } finally {
await Future.wait<Null>(forwardedPorts.map<Future<Null>>((_PortForwarder pf) => pf.stop())); await Future.wait<void>(forwardedPorts.map<Future<void>>((_PortForwarder pf) => pf.stop()));
} }
return null;
} }
// A cache of VMService connections. // A cache of VMService connections.
...@@ -286,7 +288,7 @@ class FuchsiaReloadCommand extends FlutterCommand { ...@@ -286,7 +288,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
'${extraTabs}External: $external\n'; '${extraTabs}External: $external\n';
} }
Future<Null> _listVMs(List<int> ports) async { Future<void> _listVMs(List<int> ports) async {
for (int port in ports) { for (int port in ports) {
final VMService vmService = await _getVMService(port); final VMService vmService = await _getVMService(port);
await vmService.getVM(); await vmService.getVM();
...@@ -295,7 +297,7 @@ class FuchsiaReloadCommand extends FlutterCommand { ...@@ -295,7 +297,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
} }
} }
Future<Null> _validateArguments() async { Future<void> _validateArguments() async {
final String fuchsiaBuildDir = argResults['build-dir']; final String fuchsiaBuildDir = argResults['build-dir'];
final String gnTarget = argResults['gn-target']; final String gnTarget = argResults['gn-target'];
...@@ -485,7 +487,7 @@ class _PortForwarder { ...@@ -485,7 +487,7 @@ class _PortForwarder {
return _PortForwarder._(address, remotePort, localPort, process, sshConfig); return _PortForwarder._(address, remotePort, localPort, process, sshConfig);
} }
Future<Null> stop() async { Future<void> stop() async {
// Kill the original ssh process if it is still around. // Kill the original ssh process if it is still around.
if (_process != null) { if (_process != null) {
printTrace('_PortForwarder killing ${_process.pid} for port $_localPort'); printTrace('_PortForwarder killing ${_process.pid} for port $_localPort');
......
...@@ -218,7 +218,7 @@ class IdeConfigCommand extends FlutterCommand { ...@@ -218,7 +218,7 @@ class IdeConfigCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (argResults.rest.isNotEmpty) { if (argResults.rest.isNotEmpty) {
throwToolExit('Currently, the only supported IDE is IntelliJ\n$usage', exitCode: 2); throwToolExit('Currently, the only supported IDE is IntelliJ\n$usage', exitCode: 2);
} }
...@@ -227,7 +227,7 @@ class IdeConfigCommand extends FlutterCommand { ...@@ -227,7 +227,7 @@ class IdeConfigCommand extends FlutterCommand {
if (argResults['update-templates']) { if (argResults['update-templates']) {
_handleTemplateUpdate(); _handleTemplateUpdate();
return; return null;
} }
final String flutterRoot = fs.path.absolute(Cache.flutterRoot); final String flutterRoot = fs.path.absolute(Cache.flutterRoot);
...@@ -250,6 +250,8 @@ class IdeConfigCommand extends FlutterCommand { ...@@ -250,6 +250,8 @@ class IdeConfigCommand extends FlutterCommand {
printStatus(''); printStatus('');
printStatus('Your IntelliJ configuration is now up to date. It is prudent to ' printStatus('Your IntelliJ configuration is now up to date. It is prudent to '
'restart IntelliJ, if running.'); 'restart IntelliJ, if running.');
return null;
} }
int _renderTemplate(String templateName, String dirPath, Map<String, dynamic> context) { int _renderTemplate(String templateName, String dirPath, Map<String, dynamic> context) {
......
...@@ -24,7 +24,7 @@ class InjectPluginsCommand extends FlutterCommand { ...@@ -24,7 +24,7 @@ class InjectPluginsCommand extends FlutterCommand {
final bool hidden; final bool hidden;
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final FlutterProject project = await FlutterProject.current(); final FlutterProject project = await FlutterProject.current();
refreshPluginsList(project); refreshPluginsList(project);
await injectPlugins(project); await injectPlugins(project);
...@@ -34,5 +34,7 @@ class InjectPluginsCommand extends FlutterCommand { ...@@ -34,5 +34,7 @@ class InjectPluginsCommand extends FlutterCommand {
} else { } else {
printStatus('This project does not use plugins, no GeneratedPluginRegistrants have been created.'); printStatus('This project does not use plugins, no GeneratedPluginRegistrants have been created.');
} }
return null;
} }
} }
...@@ -25,7 +25,7 @@ class InstallCommand extends FlutterCommand { ...@@ -25,7 +25,7 @@ class InstallCommand extends FlutterCommand {
Device device; Device device;
@override @override
Future<Null> validateCommand() async { Future<void> validateCommand() async {
await super.validateCommand(); await super.validateCommand();
device = await findTargetDevice(); device = await findTargetDevice();
if (device == null) if (device == null)
...@@ -33,7 +33,7 @@ class InstallCommand extends FlutterCommand { ...@@ -33,7 +33,7 @@ class InstallCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final ApplicationPackage package = await applicationPackages.getPackageForPlatform(await device.targetPlatform); final ApplicationPackage package = await applicationPackages.getPackageForPlatform(await device.targetPlatform);
Cache.releaseLockEarly(); Cache.releaseLockEarly();
...@@ -42,6 +42,8 @@ class InstallCommand extends FlutterCommand { ...@@ -42,6 +42,8 @@ class InstallCommand extends FlutterCommand {
if (!await installApp(device, package)) if (!await installApp(device, package))
throwToolExit('Install failed'); throwToolExit('Install failed');
return null;
} }
} }
......
...@@ -37,7 +37,7 @@ class LogsCommand extends FlutterCommand { ...@@ -37,7 +37,7 @@ class LogsCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (argResults['clear']) if (argResults['clear'])
device.clearLogs(); device.clearLogs();
...@@ -76,5 +76,7 @@ class LogsCommand extends FlutterCommand { ...@@ -76,5 +76,7 @@ class LogsCommand extends FlutterCommand {
await subscription.cancel(); await subscription.cancel();
if (result != 0) if (result != 0)
throwToolExit('Error listening to $logReader logs.'); throwToolExit('Error listening to $logReader logs.');
return null;
} }
} }
...@@ -24,7 +24,7 @@ class MakeHostAppEditableCommand extends FlutterCommand { ...@@ -24,7 +24,7 @@ class MakeHostAppEditableCommand extends FlutterCommand {
bool get hidden => true; bool get hidden => true;
@override @override
Future<Null> runCommand() async { } Future<FlutterCommandResult> runCommand() async => null;
} }
abstract class MakeHostAppEditableSubCommand extends FlutterCommand { abstract class MakeHostAppEditableSubCommand extends FlutterCommand {
...@@ -36,12 +36,13 @@ abstract class MakeHostAppEditableSubCommand extends FlutterCommand { ...@@ -36,12 +36,13 @@ abstract class MakeHostAppEditableSubCommand extends FlutterCommand {
@override @override
@mustCallSuper @mustCallSuper
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
await _project.ensureReadyForPlatformSpecificTooling(); await _project.ensureReadyForPlatformSpecificTooling();
return null;
} }
@override @override
Future<Null> validateCommand() async { Future<void> validateCommand() async {
await super.validateCommand(); await super.validateCommand();
_project = await FlutterProject.current(); _project = await FlutterProject.current();
if (!_project.isApplication) if (!_project.isApplication)
...@@ -57,9 +58,11 @@ class MakeHostAppEditableAndroidCommand extends MakeHostAppEditableSubCommand { ...@@ -57,9 +58,11 @@ class MakeHostAppEditableAndroidCommand extends MakeHostAppEditableSubCommand {
String get description => 'Make an Android host app editable within a Flutter project'; String get description => 'Make an Android host app editable within a Flutter project';
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
await super.runCommand(); await super.runCommand();
await _project.android.makeHostAppEditable(); await _project.android.makeHostAppEditable();
return null;
} }
} }
...@@ -71,8 +74,10 @@ class MakeHostAppEditableIosCommand extends MakeHostAppEditableSubCommand { ...@@ -71,8 +74,10 @@ class MakeHostAppEditableIosCommand extends MakeHostAppEditableSubCommand {
String get description => 'Make an iOS host app editable within a Flutter project'; String get description => 'Make an iOS host app editable within a Flutter project';
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
await super.runCommand(); await super.runCommand();
await _project.ios.makeHostAppEditable(); await _project.ios.makeHostAppEditable();
return null;
} }
} }
...@@ -28,7 +28,7 @@ class PackagesCommand extends FlutterCommand { ...@@ -28,7 +28,7 @@ class PackagesCommand extends FlutterCommand {
final String description = 'Commands for managing Flutter packages.'; final String description = 'Commands for managing Flutter packages.';
@override @override
Future<Null> runCommand() async { } Future<FlutterCommandResult> runCommand() async => null;
} }
class PackagesGetCommand extends FlutterCommand { class PackagesGetCommand extends FlutterCommand {
...@@ -65,7 +65,7 @@ class PackagesGetCommand extends FlutterCommand { ...@@ -65,7 +65,7 @@ class PackagesGetCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (argResults.rest.length > 1) if (argResults.rest.length > 1)
throwToolExit('Too many arguments.\n$usage'); throwToolExit('Too many arguments.\n$usage');
...@@ -89,6 +89,8 @@ class PackagesGetCommand extends FlutterCommand { ...@@ -89,6 +89,8 @@ class PackagesGetCommand extends FlutterCommand {
await _runPubGet(exampleProject.directory.path); await _runPubGet(exampleProject.directory.path);
await exampleProject.ensureReadyForPlatformSpecificTooling(); await exampleProject.ensureReadyForPlatformSpecificTooling();
} }
return null;
} }
} }
...@@ -116,7 +118,10 @@ class PackagesTestCommand extends FlutterCommand { ...@@ -116,7 +118,10 @@ class PackagesTestCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() => pub(<String>['run', 'test']..addAll(argResults.rest), context: PubContext.runTest, retry: false); Future<FlutterCommandResult> runCommand() async {
await pub(<String>['run', 'test']..addAll(argResults.rest), context: PubContext.runTest, retry: false);
return null;
}
} }
class PackagesPassthroughCommand extends FlutterCommand { class PackagesPassthroughCommand extends FlutterCommand {
...@@ -139,5 +144,8 @@ class PackagesPassthroughCommand extends FlutterCommand { ...@@ -139,5 +144,8 @@ class PackagesPassthroughCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() => pubInteractively(argResults.rest); Future<FlutterCommandResult> runCommand() async {
await pubInteractively(argResults.rest);
return null;
}
} }
...@@ -23,7 +23,7 @@ class PrecacheCommand extends FlutterCommand { ...@@ -23,7 +23,7 @@ class PrecacheCommand extends FlutterCommand {
bool get shouldUpdateCache => false; bool get shouldUpdateCache => false;
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (argResults['all-platforms']) if (argResults['all-platforms'])
cache.includeAllPlatforms = true; cache.includeAllPlatforms = true;
...@@ -31,5 +31,7 @@ class PrecacheCommand extends FlutterCommand { ...@@ -31,5 +31,7 @@ class PrecacheCommand extends FlutterCommand {
printStatus('Already up-to-date.'); printStatus('Already up-to-date.');
else else
await cache.updateAll(); await cache.updateAll();
return null;
} }
} }
...@@ -237,7 +237,7 @@ class RunCommand extends RunCommandBase { ...@@ -237,7 +237,7 @@ class RunCommand extends RunCommandBase {
bool get stayResident => argResults['resident']; bool get stayResident => argResults['resident'];
@override @override
Future<Null> validateCommand() async { Future<void> validateCommand() async {
// When running with a prebuilt application, no command validation is // When running with a prebuilt application, no command validation is
// necessary. // necessary.
if (!runningWithPrebuiltApplication) if (!runningWithPrebuiltApplication)
......
...@@ -76,22 +76,27 @@ class ScreenshotCommand extends FlutterCommand { ...@@ -76,22 +76,27 @@ class ScreenshotCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
File outputFile; File outputFile;
if (argResults.wasParsed(_kOut)) if (argResults.wasParsed(_kOut))
outputFile = fs.file(argResults[_kOut]); outputFile = fs.file(argResults[_kOut]);
switch (argResults[_kType]) { switch (argResults[_kType]) {
case _kDeviceType: case _kDeviceType:
return runScreenshot(outputFile); await runScreenshot(outputFile);
return null;
case _kSkiaType: case _kSkiaType:
return runSkia(outputFile); await runSkia(outputFile);
return null;
case _kRasterizerType: case _kRasterizerType:
return runRasterizer(outputFile); await runRasterizer(outputFile);
return null;
} }
return null;
} }
Future<Null> runScreenshot(File outputFile) async { Future<void> runScreenshot(File outputFile) async {
outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'png'); outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'png');
try { try {
await device.takeScreenshot(outputFile); await device.takeScreenshot(outputFile);
...@@ -101,7 +106,7 @@ class ScreenshotCommand extends FlutterCommand { ...@@ -101,7 +106,7 @@ class ScreenshotCommand extends FlutterCommand {
await showOutputFileInfo(outputFile); await showOutputFileInfo(outputFile);
} }
Future<Null> runSkia(File outputFile) async { Future<void> runSkia(File outputFile) async {
final Map<String, dynamic> skp = await _invokeVmServiceRpc('_flutter.screenshotSkp'); final Map<String, dynamic> skp = await _invokeVmServiceRpc('_flutter.screenshotSkp');
outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'skp'); outputFile ??= getUniqueFile(fs.currentDirectory, 'flutter', 'skp');
final IOSink sink = outputFile.openWrite(); final IOSink sink = outputFile.openWrite();
...@@ -138,7 +143,7 @@ class ScreenshotCommand extends FlutterCommand { ...@@ -138,7 +143,7 @@ class ScreenshotCommand extends FlutterCommand {
} }
} }
Future<Null> showOutputFileInfo(File outputFile) async { Future<void> showOutputFileInfo(File outputFile) async {
final int sizeKB = (await outputFile.length()) ~/ 1024; final int sizeKB = (await outputFile.length()) ~/ 1024;
printStatus('Screenshot written to ${fs.path.relative(outputFile.path)} (${sizeKB}kB).'); printStatus('Screenshot written to ${fs.path.relative(outputFile.path)} (${sizeKB}kB).');
} }
......
...@@ -42,14 +42,14 @@ class ShellCompletionCommand extends FlutterCommand { ...@@ -42,14 +42,14 @@ class ShellCompletionCommand extends FlutterCommand {
Future<String> get usagePath => null; Future<String> get usagePath => null;
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
if (argResults.rest.length > 1) { if (argResults.rest.length > 1) {
throwToolExit('Too many arguments given to bash-completion command.', exitCode: 1); throwToolExit('Too many arguments given to bash-completion command.', exitCode: 1);
} }
if (argResults.rest.isEmpty || argResults.rest.first == '-') { if (argResults.rest.isEmpty || argResults.rest.first == '-') {
stdout.write(generateCompletionScript(<String>['flutter'])); stdout.write(generateCompletionScript(<String>['flutter']));
return; return null;
} }
final File outputFile = fs.file(argResults.rest.first); final File outputFile = fs.file(argResults.rest.first);
...@@ -65,5 +65,7 @@ class ShellCompletionCommand extends FlutterCommand { ...@@ -65,5 +65,7 @@ class ShellCompletionCommand extends FlutterCommand {
} on FileSystemException catch (error) { } on FileSystemException catch (error) {
throwToolExit('Unable to write shell completion setup script.\n$error', exitCode: 1); throwToolExit('Unable to write shell completion setup script.\n$error', exitCode: 1);
} }
return null;
} }
} }
...@@ -25,7 +25,7 @@ class StopCommand extends FlutterCommand { ...@@ -25,7 +25,7 @@ class StopCommand extends FlutterCommand {
Device device; Device device;
@override @override
Future<Null> validateCommand() async { Future<void> validateCommand() async {
await super.validateCommand(); await super.validateCommand();
device = await findTargetDevice(); device = await findTargetDevice();
if (device == null) if (device == null)
...@@ -33,7 +33,7 @@ class StopCommand extends FlutterCommand { ...@@ -33,7 +33,7 @@ class StopCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final TargetPlatform targetPlatform = await device.targetPlatform; final TargetPlatform targetPlatform = await device.targetPlatform;
final ApplicationPackage app = await applicationPackages.getPackageForPlatform(targetPlatform); final ApplicationPackage app = await applicationPackages.getPackageForPlatform(targetPlatform);
if (app == null) { if (app == null) {
...@@ -43,5 +43,7 @@ class StopCommand extends FlutterCommand { ...@@ -43,5 +43,7 @@ class StopCommand extends FlutterCommand {
printStatus('Stopping apps on ${device.name}.'); printStatus('Stopping apps on ${device.name}.');
if (!await device.stopApp(app)) if (!await device.stopApp(app))
throwToolExit(null); throwToolExit(null);
return null;
} }
} }
...@@ -89,7 +89,7 @@ class TestCommand extends FlutterCommand { ...@@ -89,7 +89,7 @@ class TestCommand extends FlutterCommand {
String get description => 'Run Flutter unit tests for the current project.'; String get description => 'Run Flutter unit tests for the current project.';
@override @override
Future<Null> validateCommand() async { Future<void> validateCommand() async {
await super.validateCommand(); await super.validateCommand();
if (!fs.isFileSync('pubspec.yaml')) { if (!fs.isFileSync('pubspec.yaml')) {
throwToolExit( throwToolExit(
......
...@@ -44,7 +44,7 @@ class TraceCommand extends FlutterCommand { ...@@ -44,7 +44,7 @@ class TraceCommand extends FlutterCommand {
'The --debug-port argument is required.'; 'The --debug-port argument is required.';
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
int observatoryPort; int observatoryPort;
if (argResults.wasParsed('debug-port')) { if (argResults.wasParsed('debug-port')) {
observatoryPort = int.tryParse(argResults['debug-port']); observatoryPort = int.tryParse(argResults['debug-port']);
...@@ -88,12 +88,14 @@ class TraceCommand extends FlutterCommand { ...@@ -88,12 +88,14 @@ class TraceCommand extends FlutterCommand {
if (start) if (start)
await tracing.startTracing(); await tracing.startTracing();
await Future<Null>.delayed(duration); await Future<void>.delayed(duration);
if (stop) if (stop)
await _stopTracing(tracing); await _stopTracing(tracing);
return null;
} }
Future<Null> _stopTracing(Tracing tracing) async { Future<void> _stopTracing(Tracing tracing) async {
final Map<String, dynamic> timeline = await tracing.stopTracingAndDownloadTimeline(); final Map<String, dynamic> timeline = await tracing.stopTracingAndDownloadTimeline();
File localFile; File localFile;
......
...@@ -82,7 +82,7 @@ class UpdatePackagesCommand extends FlutterCommand { ...@@ -82,7 +82,7 @@ class UpdatePackagesCommand extends FlutterCommand {
@override @override
final bool hidden; final bool hidden;
Future<Null> _downloadCoverageData() async { Future<void> _downloadCoverageData() async {
final Status status = logger.startProgress( final Status status = logger.startProgress(
'Downloading lcov data for package:flutter...', 'Downloading lcov data for package:flutter...',
expectSlowOperation: true, expectSlowOperation: true,
...@@ -100,7 +100,7 @@ class UpdatePackagesCommand extends FlutterCommand { ...@@ -100,7 +100,7 @@ class UpdatePackagesCommand extends FlutterCommand {
} }
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
final List<Directory> packages = runner.getRepoPackages(); final List<Directory> packages = runner.getRepoPackages();
final bool upgrade = argResults['force-upgrade']; final bool upgrade = argResults['force-upgrade'];
...@@ -163,7 +163,7 @@ class UpdatePackagesCommand extends FlutterCommand { ...@@ -163,7 +163,7 @@ class UpdatePackagesCommand extends FlutterCommand {
); );
} }
printStatus('All pubspecs were up to date.'); printStatus('All pubspecs were up to date.');
return; return null;
} }
if (upgrade || isPrintPaths || isPrintTransitiveClosure) { if (upgrade || isPrintPaths || isPrintTransitiveClosure) {
...@@ -265,12 +265,12 @@ class UpdatePackagesCommand extends FlutterCommand { ...@@ -265,12 +265,12 @@ class UpdatePackagesCommand extends FlutterCommand {
tree._dependencyTree.forEach((String from, Set<String> to) { tree._dependencyTree.forEach((String from, Set<String> to) {
printStatus('$from -> $to'); printStatus('$from -> $to');
}); });
return; return null;
} }
if (isPrintPaths) { if (isPrintPaths) {
showDependencyPaths(from: argResults['from'], to: argResults['to'], tree: tree); showDependencyPaths(from: argResults['from'], to: argResults['to'], tree: tree);
return; return null;
} }
// Now that we have collected all the data, we can apply our dependency // Now that we have collected all the data, we can apply our dependency
...@@ -302,6 +302,8 @@ class UpdatePackagesCommand extends FlutterCommand { ...@@ -302,6 +302,8 @@ class UpdatePackagesCommand extends FlutterCommand {
final double seconds = timer.elapsedMilliseconds / 1000.0; final double seconds = timer.elapsedMilliseconds / 1000.0;
printStatus('\nRan \'pub\' $count time${count == 1 ? "" : "s"} and fetched coverage data in ${seconds.toStringAsFixed(1)}s.'); printStatus('\nRan \'pub\' $count time${count == 1 ? "" : "s"} and fetched coverage data in ${seconds.toStringAsFixed(1)}s.');
return null;
} }
void showDependencyPaths({ void showDependencyPaths({
......
...@@ -28,7 +28,7 @@ class UpgradeCommand extends FlutterCommand { ...@@ -28,7 +28,7 @@ class UpgradeCommand extends FlutterCommand {
bool get shouldUpdateCache => false; bool get shouldUpdateCache => false;
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
try { try {
await runCheckedAsync(<String>[ await runCheckedAsync(<String>[
'git', 'rev-parse', '@{u}' 'git', 'rev-parse', '@{u}'
...@@ -85,6 +85,8 @@ class UpgradeCommand extends FlutterCommand { ...@@ -85,6 +85,8 @@ class UpgradeCommand extends FlutterCommand {
workingDirectory: Cache.flutterRoot, workingDirectory: Cache.flutterRoot,
allowReentrantFlutter: true, allowReentrantFlutter: true,
); );
return null;
} }
// dev/benchmarks/complex_layout/lib/main.dart | 24 +- // dev/benchmarks/complex_layout/lib/main.dart | 24 +-
......
...@@ -80,7 +80,7 @@ class CrashReportSender { ...@@ -80,7 +80,7 @@ class CrashReportSender {
/// Sends one crash report. /// Sends one crash report.
/// ///
/// The report is populated from data in [error] and [stackTrace]. /// The report is populated from data in [error] and [stackTrace].
Future<Null> sendReport({ Future<void> sendReport({
@required dynamic error, @required dynamic error,
@required StackTrace stackTrace, @required StackTrace stackTrace,
@required String getFlutterVersion(), @required String getFlutterVersion(),
......
...@@ -27,7 +27,7 @@ class AnalysisServer { ...@@ -27,7 +27,7 @@ class AnalysisServer {
int _id = 0; int _id = 0;
Future<Null> start() async { Future<void> start() async {
final String snapshot = final String snapshot =
fs.path.join(sdkPath, 'bin/snapshots/analysis_server.dart.snapshot'); fs.path.join(sdkPath, 'bin/snapshots/analysis_server.dart.snapshot');
final List<String> command = <String>[ final List<String> command = <String>[
......
...@@ -69,7 +69,7 @@ bool _shouldRunPubGet({ File pubSpecYaml, File dotPackages }) { ...@@ -69,7 +69,7 @@ bool _shouldRunPubGet({ File pubSpecYaml, File dotPackages }) {
/// [context] provides extra information to package server requests to /// [context] provides extra information to package server requests to
/// understand usage. /// understand usage.
Future<Null> pubGet({ Future<void> pubGet({
@required PubContext context, @required PubContext context,
String directory, String directory,
bool skipIfAbsent = false, bool skipIfAbsent = false,
...@@ -135,7 +135,7 @@ typedef MessageFilter = String Function(String message); ...@@ -135,7 +135,7 @@ typedef MessageFilter = String Function(String message);
/// ///
/// [context] provides extra information to package server requests to /// [context] provides extra information to package server requests to
/// understand usage. /// understand usage.
Future<Null> pub(List<String> arguments, { Future<void> pub(List<String> arguments, {
@required PubContext context, @required PubContext context,
String directory, String directory,
MessageFilter filter, MessageFilter filter,
...@@ -161,7 +161,7 @@ Future<Null> pub(List<String> arguments, { ...@@ -161,7 +161,7 @@ Future<Null> pub(List<String> arguments, {
if (code != 69) // UNAVAILABLE in https://github.com/dart-lang/pub/blob/master/lib/src/exit_codes.dart if (code != 69) // UNAVAILABLE in https://github.com/dart-lang/pub/blob/master/lib/src/exit_codes.dart
break; break;
printStatus('$failureMessage ($code) -- attempting retry $attempts in $duration second${ duration == 1 ? "" : "s"}...'); printStatus('$failureMessage ($code) -- attempting retry $attempts in $duration second${ duration == 1 ? "" : "s"}...');
await Future<Null>.delayed(Duration(seconds: duration)); await Future<void>.delayed(Duration(seconds: duration));
if (duration < 64) if (duration < 64)
duration *= 2; duration *= 2;
} }
...@@ -173,7 +173,7 @@ Future<Null> pub(List<String> arguments, { ...@@ -173,7 +173,7 @@ Future<Null> pub(List<String> arguments, {
/// Runs pub in 'interactive' mode, directly piping the stdin stream of this /// Runs pub in 'interactive' mode, directly piping the stdin stream of this
/// process to that of pub, and the stdout/stderr stream of pub to the corresponding /// process to that of pub, and the stdout/stderr stream of pub to the corresponding
/// streams of this process. /// streams of this process.
Future<Null> pubInteractively(List<String> arguments, { Future<void> pubInteractively(List<String> arguments, {
String directory, String directory,
}) async { }) async {
Cache.releaseLockEarly(); Cache.releaseLockEarly();
......
...@@ -264,13 +264,13 @@ class _DevFSHttpWriter { ...@@ -264,13 +264,13 @@ class _DevFSHttpWriter {
int _inFlight = 0; int _inFlight = 0;
Map<Uri, DevFSContent> _outstanding; Map<Uri, DevFSContent> _outstanding;
Completer<Null> _completer; Completer<void> _completer;
HttpClient _client; HttpClient _client;
Future<Null> write(Map<Uri, DevFSContent> entries) async { Future<void> write(Map<Uri, DevFSContent> entries) async {
_client = HttpClient(); _client = HttpClient();
_client.maxConnectionsPerHost = kMaxInFlight; _client.maxConnectionsPerHost = kMaxInFlight;
_completer = Completer<Null>(); _completer = Completer<void>();
_outstanding = Map<Uri, DevFSContent>.from(entries); _outstanding = Map<Uri, DevFSContent>.from(entries);
_scheduleWrites(); _scheduleWrites();
await _completer.future; await _completer.future;
...@@ -290,7 +290,7 @@ class _DevFSHttpWriter { ...@@ -290,7 +290,7 @@ class _DevFSHttpWriter {
} }
} }
Future<Null> _scheduleWrite( Future<void> _scheduleWrite(
Uri deviceUri, Uri deviceUri,
DevFSContent content, [ DevFSContent content, [
int retry = 0, int retry = 0,
...@@ -304,7 +304,7 @@ class _DevFSHttpWriter { ...@@ -304,7 +304,7 @@ class _DevFSHttpWriter {
final Stream<List<int>> contents = content.contentsAsCompressedStream(); final Stream<List<int>> contents = content.contentsAsCompressedStream();
await request.addStream(contents); await request.addStream(contents);
final HttpClientResponse response = await request.close(); final HttpClientResponse response = await request.close();
await response.drain<Null>(); await response.drain<void>();
} on SocketException catch (socketException, stackTrace) { } on SocketException catch (socketException, stackTrace) {
// We have one completer and can get up to kMaxInFlight errors. // We have one completer and can get up to kMaxInFlight errors.
if (!_completer.isCompleted) if (!_completer.isCompleted)
...@@ -322,7 +322,7 @@ class _DevFSHttpWriter { ...@@ -322,7 +322,7 @@ class _DevFSHttpWriter {
} }
_inFlight--; _inFlight--;
if ((_outstanding.isEmpty) && (_inFlight == 0)) { if ((_outstanding.isEmpty) && (_inFlight == 0)) {
_completer.complete(null); _completer.complete();
} else { } else {
_scheduleWrites(); _scheduleWrites();
} }
...@@ -392,7 +392,7 @@ class DevFS { ...@@ -392,7 +392,7 @@ class DevFS {
return _baseUri; return _baseUri;
} }
Future<Null> destroy() async { Future<void> destroy() async {
printTrace('DevFS: Deleting filesystem on the device ($_baseUri)'); printTrace('DevFS: Deleting filesystem on the device ($_baseUri)');
await _operations.destroy(fsName); await _operations.destroy(fsName);
printTrace('DevFS: Deleted filesystem on the device ($_baseUri)'); printTrace('DevFS: Deleted filesystem on the device ($_baseUri)');
...@@ -701,7 +701,7 @@ class DevFS { ...@@ -701,7 +701,7 @@ class DevFS {
); );
} }
Future<Null> _scanPackages(Set<String> fileFilter) async { Future<void> _scanPackages(Set<String> fileFilter) async {
StringBuffer sb; StringBuffer sb;
final PackageMap packageMap = PackageMap(_packagesFilePath); final PackageMap packageMap = PackageMap(_packagesFilePath);
......
...@@ -275,7 +275,7 @@ abstract class Device { ...@@ -275,7 +275,7 @@ abstract class Device {
bool get supportsScreenshot => false; bool get supportsScreenshot => false;
Future<void> takeScreenshot(File outputFile) => Future<Null>.error('unimplemented'); Future<void> takeScreenshot(File outputFile) => Future<void>.error('unimplemented');
@override @override
int get hashCode => id.hashCode; int get hashCode => id.hashCode;
...@@ -326,7 +326,7 @@ abstract class Device { ...@@ -326,7 +326,7 @@ abstract class Device {
} }
} }
static Future<Null> printDevices(List<Device> devices) async { static Future<void> printDevices(List<Device> devices) async {
await descriptions(devices).forEach(printStatus); await descriptions(devices).forEach(printStatus);
} }
} }
...@@ -405,7 +405,7 @@ abstract class DevicePortForwarder { ...@@ -405,7 +405,7 @@ abstract class DevicePortForwarder {
Future<int> forward(int devicePort, {int hostPort}); Future<int> forward(int devicePort, {int hostPort});
/// Stops forwarding [forwardedPort]. /// Stops forwarding [forwardedPort].
Future<Null> unforward(ForwardedPort forwardedPort); Future<void> unforward(ForwardedPort forwardedPort);
} }
/// Read the log for a particular device. /// Read the log for a particular device.
......
...@@ -41,7 +41,7 @@ class DisabledUsage implements Usage { ...@@ -41,7 +41,7 @@ class DisabledUsage implements Usage {
Stream<Map<String, dynamic>> get onSend => null; Stream<Map<String, dynamic>> get onSend => null;
@override @override
Future<Null> ensureAnalyticsSent() => Future<Null>.value(); Future<void> ensureAnalyticsSent() => Future<void>.value();
@override @override
void printWelcome() { } void printWelcome() { }
......
...@@ -112,7 +112,7 @@ class Doctor { ...@@ -112,7 +112,7 @@ class Doctor {
} }
/// Print a summary of the state of the tooling, as well as how to get more info. /// Print a summary of the state of the tooling, as well as how to get more info.
Future<Null> summary() async { Future<void> summary() async {
printStatus(await summaryText); printStatus(await summaryText);
} }
......
...@@ -68,7 +68,7 @@ class FuchsiaDevice extends Device { ...@@ -68,7 +68,7 @@ class FuchsiaDevice extends Device {
bool applicationNeedsRebuild = false, bool applicationNeedsRebuild = false,
bool usesTerminalUi = false, bool usesTerminalUi = false,
bool ipv6 = false, bool ipv6 = false,
}) => Future<Null>.error('unimplemented'); }) => Future<void>.error('unimplemented');
@override @override
Future<bool> stopApp(ApplicationPackage app) async { Future<bool> stopApp(ApplicationPackage app) async {
......
...@@ -219,7 +219,7 @@ class CocoaPods { ...@@ -219,7 +219,7 @@ class CocoaPods {
|| podfileLockFile.readAsStringSync() != manifestLockFile.readAsStringSync(); || podfileLockFile.readAsStringSync() != manifestLockFile.readAsStringSync();
} }
Future<Null> _runPodInstall(IosProject iosProject, String engineDirectory) async { Future<void> _runPodInstall(IosProject iosProject, String engineDirectory) async {
final Status status = logger.startProgress('Running pod install...', expectSlowOperation: true); final Status status = logger.startProgress('Running pod install...', expectSlowOperation: true);
final ProcessResult result = await processManager.run( final ProcessResult result = await processManager.run(
<String>['pod', 'install', '--verbose'], <String>['pod', 'install', '--verbose'],
......
...@@ -376,7 +376,7 @@ class IOSDevice extends Device { ...@@ -376,7 +376,7 @@ class IOSDevice extends Device {
bool get supportsScreenshot => iMobileDevice.isInstalled; bool get supportsScreenshot => iMobileDevice.isInstalled;
@override @override
Future<Null> takeScreenshot(File outputFile) async { Future<void> takeScreenshot(File outputFile) async {
await iMobileDevice.takeScreenshot(outputFile); await iMobileDevice.takeScreenshot(outputFile);
} }
} }
...@@ -475,7 +475,7 @@ class _IOSDeviceLogReader extends DeviceLogReader { ...@@ -475,7 +475,7 @@ class _IOSDeviceLogReader extends DeviceLogReader {
String get name => device.name; String get name => device.name;
void _start() { void _start() {
iMobileDevice.startLogger().then<Null>((Process process) { iMobileDevice.startLogger().then<void>((Process process) {
_process = process; _process = process;
_process.stdout.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).listen(_newLineHandler()); _process.stdout.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).listen(_newLineHandler());
_process.stderr.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).listen(_newLineHandler()); _process.stderr.transform<String>(utf8.decoder).transform<String>(const LineSplitter()).listen(_newLineHandler());
...@@ -576,7 +576,7 @@ class _IOSDevicePortForwarder extends DevicePortForwarder { ...@@ -576,7 +576,7 @@ class _IOSDevicePortForwarder extends DevicePortForwarder {
} }
@override @override
Future<Null> unforward(ForwardedPort forwardedPort) async { Future<void> unforward(ForwardedPort forwardedPort) async {
if (!_forwardedPorts.remove(forwardedPort)) { if (!_forwardedPorts.remove(forwardedPort)) {
// Not in list. Nothing to remove. // Not in list. Nothing to remove.
return null; return null;
......
...@@ -530,7 +530,7 @@ String readGeneratedXcconfig(String appPath) { ...@@ -530,7 +530,7 @@ String readGeneratedXcconfig(String appPath) {
return generatedXcconfigFile.readAsStringSync(); return generatedXcconfigFile.readAsStringSync();
} }
Future<Null> diagnoseXcodeBuildFailure(XcodeBuildResult result) async { Future<void> diagnoseXcodeBuildFailure(XcodeBuildResult result) async {
if (result.xcodeBuildExecution != null && if (result.xcodeBuildExecution != null &&
result.xcodeBuildExecution.buildForPhysicalDevice && result.xcodeBuildExecution.buildForPhysicalDevice &&
result.stdout?.contains('BCEROR') == true && result.stdout?.contains('BCEROR') == true &&
...@@ -625,7 +625,7 @@ bool _checkXcodeVersion() { ...@@ -625,7 +625,7 @@ bool _checkXcodeVersion() {
return true; return true;
} }
Future<Null> _addServicesToBundle(Directory bundle) async { Future<void> _addServicesToBundle(Directory bundle) async {
final List<Map<String, String>> services = <Map<String, String>>[]; final List<Map<String, String>> services = <Map<String, String>>[];
printTrace('Trying to resolve native pub services.'); printTrace('Trying to resolve native pub services.');
...@@ -644,7 +644,7 @@ Future<Null> _addServicesToBundle(Directory bundle) async { ...@@ -644,7 +644,7 @@ Future<Null> _addServicesToBundle(Directory bundle) async {
_copyServiceDefinitionsManifest(services, manifestFile); _copyServiceDefinitionsManifest(services, manifestFile);
} }
Future<Null> _copyServiceFrameworks(List<Map<String, String>> services, Directory frameworksDirectory) async { Future<void> _copyServiceFrameworks(List<Map<String, String>> services, Directory frameworksDirectory) async {
printTrace("Copying service frameworks to '${fs.path.absolute(frameworksDirectory.path)}'."); printTrace("Copying service frameworks to '${fs.path.absolute(frameworksDirectory.path)}'.");
frameworksDirectory.createSync(recursive: true); frameworksDirectory.createSync(recursive: true);
for (Map<String, String> service in services) { for (Map<String, String> service in services) {
......
...@@ -438,7 +438,7 @@ class IOSSimulator extends Device { ...@@ -438,7 +438,7 @@ class IOSSimulator extends Device {
} }
} }
Future<Null> ensureLogsExists() async { Future<void> ensureLogsExists() async {
if (await sdkMajorVersion < 11) { if (await sdkMajorVersion < 11) {
final File logFile = fs.file(logFilePath); final File logFile = fs.file(logFilePath);
if (!logFile.existsSync()) if (!logFile.existsSync())
...@@ -506,7 +506,7 @@ class _IOSSimulatorLogReader extends DeviceLogReader { ...@@ -506,7 +506,7 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
@override @override
String get name => device.name; String get name => device.name;
Future<Null> _start() async { Future<void> _start() async {
// Device log. // Device log.
await device.ensureLogsExists(); await device.ensureLogsExists();
_deviceProcess = await launchDeviceLogTool(device); _deviceProcess = await launchDeviceLogTool(device);
...@@ -695,7 +695,7 @@ class _IOSSimulatorDevicePortForwarder extends DevicePortForwarder { ...@@ -695,7 +695,7 @@ class _IOSSimulatorDevicePortForwarder extends DevicePortForwarder {
} }
@override @override
Future<Null> unforward(ForwardedPort forwardedPort) async { Future<void> unforward(ForwardedPort forwardedPort) async {
_ports.remove(forwardedPort); _ports.remove(forwardedPort);
} }
} }
...@@ -50,9 +50,9 @@ class ProtocolDiscovery { ...@@ -50,9 +50,9 @@ class ProtocolDiscovery {
/// The discovered service URI. /// The discovered service URI.
Future<Uri> get uri => _completer.future; Future<Uri> get uri => _completer.future;
Future<Null> cancel() => _stopScrapingLogs(); Future<void> cancel() => _stopScrapingLogs();
Future<Null> _stopScrapingLogs() async { Future<void> _stopScrapingLogs() async {
await _deviceLogSubscription?.cancel(); await _deviceLogSubscription?.cancel();
_deviceLogSubscription = null; _deviceLogSubscription = null;
} }
......
...@@ -109,16 +109,16 @@ class ColdRunner extends ResidentRunner { ...@@ -109,16 +109,16 @@ class ColdRunner extends ResidentRunner {
} }
@override @override
Future<Null> handleTerminalCommand(String code) async => null; Future<void> handleTerminalCommand(String code) async => null;
@override @override
Future<Null> cleanupAfterSignal() async { Future<void> cleanupAfterSignal() async {
await stopEchoingDeviceLog(); await stopEchoingDeviceLog();
await stopApp(); await stopApp();
} }
@override @override
Future<Null> cleanupAtFinish() async { Future<void> cleanupAtFinish() async {
await stopEchoingDeviceLog(); await stopEchoingDeviceLog();
} }
...@@ -152,7 +152,7 @@ class ColdRunner extends ResidentRunner { ...@@ -152,7 +152,7 @@ class ColdRunner extends ResidentRunner {
} }
@override @override
Future<Null> preStop() async { Future<void> preStop() async {
for (FlutterDevice device in flutterDevices) { for (FlutterDevice device in flutterDevices) {
// If we're running in release mode, stop the app using the device logic. // If we're running in release mode, stop the app using the device logic.
if (device.vmServices == null || device.vmServices.isEmpty) if (device.vmServices == null || device.vmServices.isEmpty)
......
...@@ -120,7 +120,7 @@ class HotRunner extends ResidentRunner { ...@@ -120,7 +120,7 @@ class HotRunner extends ResidentRunner {
return true; return true;
} }
Future<Null> _reloadSourcesService(String isolateId, Future<void> _reloadSourcesService(String isolateId,
{ bool force = false, bool pause = false }) async { { bool force = false, bool pause = false }) async {
// TODO(cbernaschina): check that isolateId is the id of the UI isolate. // TODO(cbernaschina): check that isolateId is the id of the UI isolate.
final OperationResult result = await restart(pauseAfterRestart: pause); final OperationResult result = await restart(pauseAfterRestart: pause);
...@@ -276,7 +276,7 @@ class HotRunner extends ResidentRunner { ...@@ -276,7 +276,7 @@ class HotRunner extends ResidentRunner {
} }
@override @override
Future<Null> handleTerminalCommand(String code) async { Future<void> handleTerminalCommand(String code) async {
final String lower = code.toLowerCase(); final String lower = code.toLowerCase();
if (lower == 'r') { if (lower == 'r') {
final OperationResult result = await restart(fullRestart: code == 'R'); final OperationResult result = await restart(fullRestart: code == 'R');
...@@ -340,7 +340,7 @@ class HotRunner extends ResidentRunner { ...@@ -340,7 +340,7 @@ class HotRunner extends ResidentRunner {
return true; return true;
} }
Future<Null> _evictDirtyAssets() async { Future<void> _evictDirtyAssets() async {
for (FlutterDevice device in flutterDevices) { for (FlutterDevice device in flutterDevices) {
if (device.devFS.assetPathsToEvict.isEmpty) if (device.devFS.assetPathsToEvict.isEmpty)
return; return;
...@@ -357,7 +357,7 @@ class HotRunner extends ResidentRunner { ...@@ -357,7 +357,7 @@ class HotRunner extends ResidentRunner {
device.devFS.assetPathsToEvict.clear(); device.devFS.assetPathsToEvict.clear();
} }
Future<Null> _cleanupDevFS() async { Future<void> _cleanupDevFS() async {
for (FlutterDevice device in flutterDevices) { for (FlutterDevice device in flutterDevices) {
if (device.devFS != null) { if (device.devFS != null) {
// Cleanup the devFS; don't wait indefinitely, and ignore any errors. // Cleanup the devFS; don't wait indefinitely, and ignore any errors.
...@@ -371,7 +371,7 @@ class HotRunner extends ResidentRunner { ...@@ -371,7 +371,7 @@ class HotRunner extends ResidentRunner {
} }
} }
Future<Null> _launchInView(FlutterDevice device, Future<void> _launchInView(FlutterDevice device,
Uri entryUri, Uri entryUri,
Uri packagesUri, Uri packagesUri,
Uri assetsDirectoryUri) async { Uri assetsDirectoryUri) async {
...@@ -379,7 +379,7 @@ class HotRunner extends ResidentRunner { ...@@ -379,7 +379,7 @@ class HotRunner extends ResidentRunner {
await view.runFromSource(entryUri, packagesUri, assetsDirectoryUri); await view.runFromSource(entryUri, packagesUri, assetsDirectoryUri);
} }
Future<Null> _launchFromDevFS(String mainScript) async { Future<void> _launchFromDevFS(String mainScript) async {
final String entryUri = fs.path.relative(mainScript, from: projectRootPath); final String entryUri = fs.path.relative(mainScript, from: projectRootPath);
for (FlutterDevice device in flutterDevices) { for (FlutterDevice device in flutterDevices) {
final Uri deviceEntryUri = device.devFS.baseUri.resolveUri( final Uri deviceEntryUri = device.devFS.baseUri.resolveUri(
...@@ -764,7 +764,7 @@ class HotRunner extends ResidentRunner { ...@@ -764,7 +764,7 @@ class HotRunner extends ResidentRunner {
} }
@override @override
Future<Null> cleanupAfterSignal() async { Future<void> cleanupAfterSignal() async {
await stopEchoingDeviceLog(); await stopEchoingDeviceLog();
if (_didAttach) { if (_didAttach) {
appFinished(); appFinished();
...@@ -774,10 +774,10 @@ class HotRunner extends ResidentRunner { ...@@ -774,10 +774,10 @@ class HotRunner extends ResidentRunner {
} }
@override @override
Future<Null> preStop() => _cleanupDevFS(); Future<void> preStop() => _cleanupDevFS();
@override @override
Future<Null> cleanupAtFinish() async { Future<void> cleanupAtFinish() async {
await _cleanupDevFS(); await _cleanupDevFS();
await stopEchoingDeviceLog(); await stopEchoingDeviceLog();
} }
......
...@@ -65,7 +65,7 @@ class FlutterOptions { ...@@ -65,7 +65,7 @@ class FlutterOptions {
static const String kFileSystemScheme = 'filesystem-scheme'; static const String kFileSystemScheme = 'filesystem-scheme';
} }
abstract class FlutterCommand extends Command<Null> { abstract class FlutterCommand extends Command<void> {
/// The currently executing command (or sub-command). /// The currently executing command (or sub-command).
/// ///
/// Will be `null` until the top-most command has begun execution. /// Will be `null` until the top-most command has begun execution.
...@@ -294,10 +294,10 @@ abstract class FlutterCommand extends Command<Null> { ...@@ -294,10 +294,10 @@ abstract class FlutterCommand extends Command<Null> {
/// and [runCommand] to execute the command /// and [runCommand] to execute the command
/// so that this method can record and report the overall time to analytics. /// so that this method can record and report the overall time to analytics.
@override @override
Future<Null> run() { Future<void> run() {
final DateTime startTime = clock.now(); final DateTime startTime = clock.now();
return context.run<Null>( return context.run<void>(
name: 'command', name: 'command',
overrides: <Type, Generator>{FlutterCommand: () => this}, overrides: <Type, Generator>{FlutterCommand: () => this},
body: () async { body: () async {
...@@ -451,7 +451,7 @@ abstract class FlutterCommand extends Command<Null> { ...@@ -451,7 +451,7 @@ abstract class FlutterCommand extends Command<Null> {
@protected @protected
@mustCallSuper @mustCallSuper
Future<Null> validateCommand() async { Future<void> validateCommand() async {
if (_requiresPubspecYaml && !PackageMap.isUsingCustomPackagesPath) { if (_requiresPubspecYaml && !PackageMap.isUsingCustomPackagesPath) {
// Don't expect a pubspec.yaml file if the user passed in an explicit .packages file path. // Don't expect a pubspec.yaml file if the user passed in an explicit .packages file path.
if (!fs.isFileSync('pubspec.yaml')) { if (!fs.isFileSync('pubspec.yaml')) {
......
...@@ -38,7 +38,7 @@ const String kSnapshotFileName = 'flutter_tools.snapshot'; // in //flutter/bin/c ...@@ -38,7 +38,7 @@ const String kSnapshotFileName = 'flutter_tools.snapshot'; // in //flutter/bin/c
const String kFlutterToolsScriptFileName = 'flutter_tools.dart'; // in //flutter/packages/flutter_tools/bin/ const String kFlutterToolsScriptFileName = 'flutter_tools.dart'; // in //flutter/packages/flutter_tools/bin/
const String kFlutterEnginePackageName = 'sky_engine'; const String kFlutterEnginePackageName = 'sky_engine';
class FlutterCommandRunner extends CommandRunner<Null> { class FlutterCommandRunner extends CommandRunner<void> {
FlutterCommandRunner({ bool verboseHelp = false }) : super( FlutterCommandRunner({ bool verboseHelp = false }) : super(
'flutter', 'flutter',
'Manage your Flutter app development.\n' 'Manage your Flutter app development.\n'
...@@ -191,7 +191,7 @@ class FlutterCommandRunner extends CommandRunner<Null> { ...@@ -191,7 +191,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
usageException(error.message); usageException(error.message);
} }
Command<Null> command = commands[error.commands.first]; Command<void> command = commands[error.commands.first];
for (String commandName in error.commands.skip(1)) { for (String commandName in error.commands.skip(1)) {
command = command.subcommands[commandName]; command = command.subcommands[commandName];
} }
...@@ -202,7 +202,7 @@ class FlutterCommandRunner extends CommandRunner<Null> { ...@@ -202,7 +202,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
} }
@override @override
Future<Null> run(Iterable<String> args) { Future<void> run(Iterable<String> args) {
// Have an invocation of 'build' print out it's sub-commands. // Have an invocation of 'build' print out it's sub-commands.
// TODO(ianh): Move this to the Build command itself somehow. // TODO(ianh): Move this to the Build command itself somehow.
if (args.length == 1 && args.first == 'build') if (args.length == 1 && args.first == 'build')
...@@ -212,7 +212,7 @@ class FlutterCommandRunner extends CommandRunner<Null> { ...@@ -212,7 +212,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
} }
@override @override
Future<Null> runCommand(ArgResults topLevelResults) async { Future<void> runCommand(ArgResults topLevelResults) async {
final Map<Type, dynamic> contextOverrides = <Type, dynamic>{ final Map<Type, dynamic> contextOverrides = <Type, dynamic>{
Flags: Flags(topLevelResults), Flags: Flags(topLevelResults),
}; };
...@@ -300,7 +300,7 @@ class FlutterCommandRunner extends CommandRunner<Null> { ...@@ -300,7 +300,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
}); });
} }
await context.run<Null>( await context.run<void>(
overrides: contextOverrides.map<Type, Generator>((Type type, dynamic value) { overrides: contextOverrides.map<Type, Generator>((Type type, dynamic value) {
return MapEntry<Type, Generator>(type, () => value); return MapEntry<Type, Generator>(type, () => value);
}), }),
......
...@@ -25,7 +25,7 @@ dynamic _loadYamlFile(String path) { ...@@ -25,7 +25,7 @@ dynamic _loadYamlFile(String path) {
/// Loads all services specified in `pubspec.yaml`. Parses each service config file, /// Loads all services specified in `pubspec.yaml`. Parses each service config file,
/// storing meta data in [services] and the list of jar files in [jars]. /// storing meta data in [services] and the list of jar files in [jars].
Future<Null> parseServiceConfigs( Future<void> parseServiceConfigs(
List<Map<String, String>> services, { List<File> jars } List<Map<String, String>> services, { List<File> jars }
) async { ) async {
Map<String, Uri> packageMap; Map<String, Uri> packageMap;
......
...@@ -40,7 +40,7 @@ class CoverageCollector extends TestWatcher { ...@@ -40,7 +40,7 @@ class CoverageCollector extends TestWatcher {
/// has been run to completion so that all coverage data has been recorded. /// has been run to completion so that all coverage data has been recorded.
/// ///
/// The returned [Future] completes when the coverage is collected. /// The returned [Future] completes when the coverage is collected.
Future<Null> collectCoverage(Process process, Uri observatoryUri) async { Future<void> collectCoverage(Process process, Uri observatoryUri) async {
assert(process != null); assert(process != null);
assert(observatoryUri != null); assert(observatoryUri != null);
......
...@@ -190,7 +190,7 @@ void main() { ...@@ -190,7 +190,7 @@ void main() {
enum _InitialResult { crashed, timedOut, connected } enum _InitialResult { crashed, timedOut, connected }
enum _TestResult { crashed, harnessBailed, testBailed } enum _TestResult { crashed, harnessBailed, testBailed }
typedef _Finalizer = Future<Null> Function(); typedef _Finalizer = Future<void> Function();
class _CompilationRequest { class _CompilationRequest {
_CompilationRequest(this.path, this.result); _CompilationRequest(this.path, this.result);
......
...@@ -246,5 +246,5 @@ class _NoopPortForwarder extends DevicePortForwarder { ...@@ -246,5 +246,5 @@ class _NoopPortForwarder extends DevicePortForwarder {
List<ForwardedPort> get forwardedPorts => <ForwardedPort>[]; List<ForwardedPort> get forwardedPorts => <ForwardedPort>[];
@override @override
Future<Null> unforward(ForwardedPort forwardedPort) => null; Future<void> unforward(ForwardedPort forwardedPort) => null;
} }
...@@ -25,7 +25,7 @@ class Tracing { ...@@ -25,7 +25,7 @@ class Tracing {
final VMService vmService; final VMService vmService;
Future<Null> startTracing() async { Future<void> startTracing() async {
await vmService.vm.setVMTimelineFlags(<String>['Compiler', 'Dart', 'Embedder', 'GC']); await vmService.vm.setVMTimelineFlags(<String>['Compiler', 'Dart', 'Embedder', 'GC']);
await vmService.vm.clearVMTimeline(); await vmService.vm.clearVMTimeline();
} }
...@@ -41,7 +41,7 @@ class Tracing { ...@@ -41,7 +41,7 @@ class Tracing {
await vmService.vm.setVMTimelineFlags(<String>[]); await vmService.vm.setVMTimelineFlags(<String>[]);
timeline = await vmService.vm.getVMTimeline(); timeline = await vmService.vm.getVMTimeline();
} else { } else {
final Completer<Null> whenFirstFrameRendered = Completer<Null>(); final Completer<void> whenFirstFrameRendered = Completer<void>();
(await vmService.onTimelineEvent).listen((ServiceEvent timelineEvent) { (await vmService.onTimelineEvent).listen((ServiceEvent timelineEvent) {
final List<Map<String, dynamic>> events = timelineEvent.timelineEvents; final List<Map<String, dynamic>> events = timelineEvent.timelineEvents;
...@@ -74,7 +74,7 @@ class Tracing { ...@@ -74,7 +74,7 @@ class Tracing {
/// Download the startup trace information from the given observatory client and /// Download the startup trace information from the given observatory client and
/// store it to build/start_up_info.json. /// store it to build/start_up_info.json.
Future<Null> downloadStartupTrace(VMService observatory) async { Future<void> downloadStartupTrace(VMService observatory) async {
final String traceInfoFilePath = fs.path.join(getBuildDirectory(), 'start_up_info.json'); final String traceInfoFilePath = fs.path.join(getBuildDirectory(), 'start_up_info.json');
final File traceInfoFile = fs.file(traceInfoFilePath); final File traceInfoFile = fs.file(traceInfoFilePath);
......
...@@ -122,7 +122,7 @@ class Usage { ...@@ -122,7 +122,7 @@ class Usage {
/// Returns when the last analytics event has been sent, or after a fixed /// Returns when the last analytics event has been sent, or after a fixed
/// (short) delay, whichever is less. /// (short) delay, whichever is less.
Future<Null> ensureAnalyticsSent() async { Future<void> ensureAnalyticsSent() async {
// TODO(devoncarew): This may delay tool exit and could cause some analytics // TODO(devoncarew): This may delay tool exit and could cause some analytics
// events to not be reported. Perhaps we could send the analytics pings // events to not be reported. Perhaps we could send the analytics pings
// out-of-process from flutter_tools? // out-of-process from flutter_tools?
......
...@@ -158,7 +158,7 @@ class FlutterVersion { ...@@ -158,7 +158,7 @@ class FlutterVersion {
} }
} }
static Future<Null> _removeVersionCheckRemoteIfExists() async { static Future<void> _removeVersionCheckRemoteIfExists() async {
final List<String> remotes = (await _run(<String>['git', 'remote'])) final List<String> remotes = (await _run(<String>['git', 'remote']))
.split('\n') .split('\n')
.map<String>((String name) => name.trim()) // to account for OS-specific line-breaks .map<String>((String name) => name.trim()) // to account for OS-specific line-breaks
...@@ -234,7 +234,7 @@ class FlutterVersion { ...@@ -234,7 +234,7 @@ class FlutterVersion {
/// [checkFlutterVersionFreshness] is called after this. This is typically /// [checkFlutterVersionFreshness] is called after this. This is typically
/// used when switching channels so that stale information from another /// used when switching channels so that stale information from another
/// channel doesn't linger. /// channel doesn't linger.
static Future<Null> resetFlutterVersionFreshnessCheck() async { static Future<void> resetFlutterVersionFreshnessCheck() async {
try { try {
await Cache.instance.getStampFileFor( await Cache.instance.getStampFileFor(
VersionCheckStamp.kFlutterVersionCheckStampFile, VersionCheckStamp.kFlutterVersionCheckStampFile,
...@@ -249,7 +249,7 @@ class FlutterVersion { ...@@ -249,7 +249,7 @@ class FlutterVersion {
/// ///
/// This function must run while [Cache.lock] is acquired because it reads and /// This function must run while [Cache.lock] is acquired because it reads and
/// writes shared cache files. /// writes shared cache files.
Future<Null> checkFlutterVersionFreshness() async { Future<void> checkFlutterVersionFreshness() async {
// Don't perform update checks if we're not on an official channel. // Don't perform update checks if we're not on an official channel.
if (!officialChannels.contains(_channel)) { if (!officialChannels.contains(_channel)) {
return; return;
...@@ -288,11 +288,11 @@ class FlutterVersion { ...@@ -288,11 +288,11 @@ class FlutterVersion {
? newVersionAvailableMessage() ? newVersionAvailableMessage()
: versionOutOfDateMessage(frameworkAge); : versionOutOfDateMessage(frameworkAge);
printStatus(updateMessage, emphasis: true); printStatus(updateMessage, emphasis: true);
await Future.wait<Null>(<Future<Null>>[ await Future.wait<void>(<Future<void>>[
stamp.store( stamp.store(
newTimeWarningWasPrinted: _clock.now(), newTimeWarningWasPrinted: _clock.now(),
), ),
Future<Null>.delayed(timeToPauseToLetUserReadTheMessage), Future<void>.delayed(timeToPauseToLetUserReadTheMessage),
]); ]);
} }
} }
...@@ -418,7 +418,7 @@ class VersionCheckStamp { ...@@ -418,7 +418,7 @@ class VersionCheckStamp {
); );
} }
Future<Null> store({ Future<void> store({
DateTime newTimeVersionWasChecked, DateTime newTimeVersionWasChecked,
DateTime newKnownRemoteVersion, DateTime newKnownRemoteVersion,
DateTime newTimeWarningWasPrinted, DateTime newTimeWarningWasPrinted,
......
...@@ -37,7 +37,7 @@ _OpenChannel _openChannel = _defaultOpenChannel; ...@@ -37,7 +37,7 @@ _OpenChannel _openChannel = _defaultOpenChannel;
/// hot mode. /// hot mode.
/// ///
/// See: https://github.com/dart-lang/sdk/issues/30023 /// See: https://github.com/dart-lang/sdk/issues/30023
typedef ReloadSources = Future<Null> Function( typedef ReloadSources = Future<void> Function(
String isolateId, { String isolateId, {
bool force, bool force,
bool pause, bool pause,
...@@ -66,7 +66,7 @@ Future<StreamChannel<String>> _defaultOpenChannel(Uri uri) async { ...@@ -66,7 +66,7 @@ Future<StreamChannel<String>> _defaultOpenChannel(Uri uri) async {
printTrace('This was attempt #$attempts. Will retry in $delay.'); printTrace('This was attempt #$attempts. Will retry in $delay.');
// Delay next attempt. // Delay next attempt.
await Future<Null>.delayed(delay); await Future<void>.delayed(delay);
// Back off exponentially. // Back off exponentially.
delay *= 2; delay *= 2;
...@@ -260,7 +260,7 @@ class VMService { ...@@ -260,7 +260,7 @@ class VMService {
/// Whether our connection to the VM service has been closed; /// Whether our connection to the VM service has been closed;
bool get isClosed => _peer.isClosed; bool get isClosed => _peer.isClosed;
Future<Null> get done async { Future<void> get done async {
await _peer.done; await _peer.done;
} }
...@@ -332,7 +332,7 @@ class VMService { ...@@ -332,7 +332,7 @@ class VMService {
_getEventController(streamId).add(event); _getEventController(streamId).add(event);
} }
Future<Null> _streamListen(String streamId) async { Future<void> _streamListen(String streamId) async {
if (!_listeningFor.contains(streamId)) { if (!_listeningFor.contains(streamId)) {
_listeningFor.add(streamId); _listeningFor.add(streamId);
await _sendRequest('streamListen', <String, dynamic>{ 'streamId': streamId }); await _sendRequest('streamListen', <String, dynamic>{ 'streamId': streamId });
...@@ -344,7 +344,7 @@ class VMService { ...@@ -344,7 +344,7 @@ class VMService {
return await _vm.reload(); return await _vm.reload();
} }
Future<Null> refreshViews() async { Future<void> refreshViews() async {
if (!vm.isFlutterEngine) if (!vm.isFlutterEngine)
return; return;
await vm.refreshViews(); await vm.refreshViews();
...@@ -948,7 +948,7 @@ class VM extends ServiceObjectOwner { ...@@ -948,7 +948,7 @@ class VM extends ServiceObjectOwner {
return invokeRpcRaw('_getVMTimeline', timeout: kLongRequestTimeout); return invokeRpcRaw('_getVMTimeline', timeout: kLongRequestTimeout);
} }
Future<Null> refreshViews() async { Future<void> refreshViews() async {
if (!isFlutterEngine) if (!isFlutterEngine)
return; return;
_viewCache.clear(); _viewCache.clear();
...@@ -1277,7 +1277,7 @@ class Isolate extends ServiceObjectOwner { ...@@ -1277,7 +1277,7 @@ class Isolate extends ServiceObjectOwner {
Future<Map<String, dynamic>> flutterToggleWidgetInspector() => _flutterToggle('inspector.show'); Future<Map<String, dynamic>> flutterToggleWidgetInspector() => _flutterToggle('inspector.show');
Future<Null> flutterDebugAllowBanner(bool show) async { Future<void> flutterDebugAllowBanner(bool show) async {
await invokeFlutterExtensionRpcRaw( await invokeFlutterExtensionRpcRaw(
'ext.flutter.debugAllowBanner', 'ext.flutter.debugAllowBanner',
params: <String, dynamic>{ 'enabled': show ? 'true' : 'false' }, params: <String, dynamic>{ 'enabled': show ? 'true' : 'false' },
...@@ -1412,12 +1412,12 @@ class FlutterView extends ServiceObject { ...@@ -1412,12 +1412,12 @@ class FlutterView extends ServiceObject {
} }
// TODO(johnmccutchan): Report errors when running failed. // TODO(johnmccutchan): Report errors when running failed.
Future<Null> runFromSource(Uri entryUri, Future<void> runFromSource(Uri entryUri,
Uri packagesUri, Uri packagesUri,
Uri assetsDirectoryUri) async { Uri assetsDirectoryUri) async {
final String viewId = id; final String viewId = id;
// When this completer completes the isolate is running. // When this completer completes the isolate is running.
final Completer<Null> completer = Completer<Null>(); final Completer<void> completer = Completer<void>();
final StreamSubscription<ServiceEvent> subscription = final StreamSubscription<ServiceEvent> subscription =
(await owner.vm.vmService.onIsolateEvent).listen((ServiceEvent event) { (await owner.vm.vmService.onIsolateEvent).listen((ServiceEvent event) {
// TODO(johnmccutchan): Listen to the debug stream and catch initial // TODO(johnmccutchan): Listen to the debug stream and catch initial
...@@ -1425,7 +1425,7 @@ class FlutterView extends ServiceObject { ...@@ -1425,7 +1425,7 @@ class FlutterView extends ServiceObject {
if (event.kind == ServiceEvent.kIsolateRunnable) { if (event.kind == ServiceEvent.kIsolateRunnable) {
printTrace('Isolate is runnable.'); printTrace('Isolate is runnable.');
if (!completer.isCompleted) if (!completer.isCompleted)
completer.complete(null); completer.complete();
} }
}); });
await owner.vm.runInView(viewId, await owner.vm.runInView(viewId,
...@@ -1437,7 +1437,7 @@ class FlutterView extends ServiceObject { ...@@ -1437,7 +1437,7 @@ class FlutterView extends ServiceObject {
await subscription.cancel(); await subscription.cancel();
} }
Future<Null> setAssetDirectory(Uri assetsDirectory) async { Future<void> setAssetDirectory(Uri assetsDirectory) async {
assert(assetsDirectory != null); assert(assetsDirectory != null);
await owner.vmService.vm.invokeRpc<ServiceObject>('_flutter.setAssetBundlePath', await owner.vmService.vm.invokeRpc<ServiceObject>('_flutter.setAssetBundlePath',
params: <String, dynamic>{ params: <String, dynamic>{
...@@ -1449,7 +1449,7 @@ class FlutterView extends ServiceObject { ...@@ -1449,7 +1449,7 @@ class FlutterView extends ServiceObject {
bool get hasIsolate => _uiIsolate != null; bool get hasIsolate => _uiIsolate != null;
Future<Null> flushUIThreadTasks() async { Future<void> flushUIThreadTasks() async {
await owner.vm.invokeRpcRaw('_flutter.flushUIThreadTasks', await owner.vm.invokeRpcRaw('_flutter.flushUIThreadTasks',
params: <String, dynamic>{'isolateId': _uiIsolate.id}); params: <String, dynamic>{'isolateId': _uiIsolate.id});
} }
......
...@@ -253,7 +253,7 @@ class _ReplaySink implements StreamSink<String> { ...@@ -253,7 +253,7 @@ class _ReplaySink implements StreamSink<String> {
_ReplaySink(this.channel); _ReplaySink(this.channel);
final ReplayVMServiceChannel channel; final ReplayVMServiceChannel channel;
final Completer<Null> _completer = Completer<Null>(); final Completer<void> _completer = Completer<void>();
@override @override
Future<dynamic> close() { Future<dynamic> close() {
......
...@@ -52,7 +52,7 @@ void main() { ...@@ -52,7 +52,7 @@ void main() {
count = 0; count = 0;
flutterUsage.enabled = false; flutterUsage.enabled = false;
final DoctorCommand doctorCommand = DoctorCommand(); final DoctorCommand doctorCommand = DoctorCommand();
final CommandRunner<Null>runner = createTestCommandRunner(doctorCommand); final CommandRunner<void>runner = createTestCommandRunner(doctorCommand);
await runner.run(<String>['doctor']); await runner.run(<String>['doctor']);
expect(count, 0); expect(count, 0);
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
...@@ -67,7 +67,7 @@ void main() { ...@@ -67,7 +67,7 @@ void main() {
flutterUsage.enabled = false; flutterUsage.enabled = false;
final ConfigCommand command = ConfigCommand(); final ConfigCommand command = ConfigCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['config']); await runner.run(<String>['config']);
expect(count, 0); expect(count, 0);
...@@ -100,7 +100,7 @@ void main() { ...@@ -100,7 +100,7 @@ void main() {
mockTimes = <int>[1000, 2000]; mockTimes = <int>[1000, 2000];
when(mockDoctor.diagnose(androidLicenses: false, verbose: false)).thenAnswer((_) async => true); when(mockDoctor.diagnose(androidLicenses: false, verbose: false)).thenAnswer((_) async => true);
final DoctorCommand command = DoctorCommand(); final DoctorCommand command = DoctorCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['doctor']); await runner.run(<String>['doctor']);
verify(mockClock.now()).called(2); verify(mockClock.now()).called(2);
...@@ -119,7 +119,7 @@ void main() { ...@@ -119,7 +119,7 @@ void main() {
mockTimes = <int>[1000, 2000]; mockTimes = <int>[1000, 2000];
when(mockDoctor.diagnose(androidLicenses: false, verbose: false)).thenAnswer((_) async => false); when(mockDoctor.diagnose(androidLicenses: false, verbose: false)).thenAnswer((_) async => false);
final DoctorCommand command = DoctorCommand(); final DoctorCommand command = DoctorCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['doctor']); await runner.run(<String>['doctor']);
verify(mockClock.now()).called(2); verify(mockClock.now()).called(2);
......
...@@ -60,7 +60,7 @@ $fontsSection ...@@ -60,7 +60,7 @@ $fontsSection
..writeAsStringSync(packages); ..writeAsStringSync(packages);
} }
Future<Null> buildAndVerifyFonts( Future<void> buildAndVerifyFonts(
List<String> localFonts, List<String> localFonts,
List<String> packageFonts, List<String> packageFonts,
List<String> packages, List<String> packages,
......
...@@ -66,7 +66,7 @@ $assetsSection ...@@ -66,7 +66,7 @@ $assetsSection
..writeAsStringSync(packages); ..writeAsStringSync(packages);
} }
Future<Null> buildAndVerifyAssets( Future<void> buildAndVerifyAssets(
List<String> assets, List<String> assets,
List<String> packages, List<String> packages,
String expectedAssetManifest, String expectedAssetManifest,
......
...@@ -11,12 +11,12 @@ import 'package:flutter_tools/src/runner/flutter_command.dart'; ...@@ -11,12 +11,12 @@ import 'package:flutter_tools/src/runner/flutter_command.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart'; import '../src/context.dart';
typedef _TestMethod = FutureOr<Null> Function(); typedef _TestMethod = FutureOr<void> Function();
void main() { void main() {
Cache.disableLocking(); Cache.disableLocking();
Future<Null> runCommand(Iterable<String> flags, _TestMethod testMethod) async { Future<void> runCommand(Iterable<String> flags, _TestMethod testMethod) async {
final List<String> args = <String>['test']..addAll(flags); final List<String> args = <String>['test']..addAll(flags);
final _TestCommand command = _TestCommand(testMethod); final _TestCommand command = _TestCommand(testMethod);
await createTestCommandRunner(command).run(args); await createTestCommandRunner(command).run(args);
......
...@@ -43,7 +43,7 @@ void main() { ...@@ -43,7 +43,7 @@ void main() {
testUsingContext('list', () async { testUsingContext('list', () async {
final ChannelCommand command = ChannelCommand(); final ChannelCommand command = ChannelCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['channel']); await runner.run(<String>['channel']);
expect(testLogger.errorText, hasLength(0)); expect(testLogger.errorText, hasLength(0));
// The bots may return an empty list of channels (network hiccup?) // The bots may return an empty list of channels (network hiccup?)
...@@ -65,7 +65,7 @@ void main() { ...@@ -65,7 +65,7 @@ void main() {
)).thenAnswer((_) => Future<Process>.value(process)); )).thenAnswer((_) => Future<Process>.value(process));
final ChannelCommand command = ChannelCommand(); final ChannelCommand command = ChannelCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['channel']); await runner.run(<String>['channel']);
verify(mockProcessManager.start( verify(mockProcessManager.start(
...@@ -106,7 +106,7 @@ void main() { ...@@ -106,7 +106,7 @@ void main() {
)).thenAnswer((_) => Future<Process>.value(createMockProcess())); )).thenAnswer((_) => Future<Process>.value(createMockProcess()));
final ChannelCommand command = ChannelCommand(); final ChannelCommand command = ChannelCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['channel', 'beta']); await runner.run(<String>['channel', 'beta']);
verify(mockProcessManager.start( verify(mockProcessManager.start(
...@@ -166,7 +166,7 @@ void main() { ...@@ -166,7 +166,7 @@ void main() {
'''); ''');
final ChannelCommand command = ChannelCommand(); final ChannelCommand command = ChannelCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['channel', 'beta']); await runner.run(<String>['channel', 'beta']);
verify(mockProcessManager.start( verify(mockProcessManager.start(
......
...@@ -191,7 +191,7 @@ void assertContains(String text, List<String> patterns) { ...@@ -191,7 +191,7 @@ void assertContains(String text, List<String> patterns) {
} }
} }
Future<Null> runCommand({ Future<void> runCommand({
FlutterCommand command, FlutterCommand command,
List<String> arguments, List<String> arguments,
List<String> statusTextContains, List<String> statusTextContains,
......
...@@ -234,7 +234,7 @@ void main() { ...@@ -234,7 +234,7 @@ void main() {
when(mockFlutterVersion.channel).thenReturn(frameworkChannel); when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--template=application', '--no-pub', '--org', 'com.foo.bar', projectDir.path]); await runner.run(<String>['create', '--template=application', '--no-pub', '--org', 'com.foo.bar', projectDir.path]);
...@@ -305,7 +305,7 @@ void main() { ...@@ -305,7 +305,7 @@ void main() {
when(mockFlutterVersion.channel).thenReturn(frameworkChannel); when(mockFlutterVersion.channel).thenReturn(frameworkChannel);
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--template=app', '--no-pub', '--org', 'com.foo.bar', projectDir.path]); await runner.run(<String>['create', '--template=app', '--no-pub', '--org', 'com.foo.bar', projectDir.path]);
...@@ -374,7 +374,7 @@ void main() { ...@@ -374,7 +374,7 @@ void main() {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', projectDir.path]); await runner.run(<String>['create', '--no-pub', projectDir.path]);
...@@ -385,7 +385,7 @@ void main() { ...@@ -385,7 +385,7 @@ void main() {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', '--template=app', projectDir.path]); await runner.run(<String>['create', '--no-pub', '--template=app', projectDir.path]);
...@@ -402,7 +402,7 @@ void main() { ...@@ -402,7 +402,7 @@ void main() {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', '--template=app', projectDir.path]); await runner.run(<String>['create', '--no-pub', '--template=app', projectDir.path]);
...@@ -416,7 +416,7 @@ void main() { ...@@ -416,7 +416,7 @@ void main() {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]); await runner.run(<String>['create', '--no-pub', '--template=plugin', projectDir.path]);
...@@ -430,7 +430,7 @@ void main() { ...@@ -430,7 +430,7 @@ void main() {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--no-pub', '--template=package', projectDir.path]); await runner.run(<String>['create', '--no-pub', '--template=package', projectDir.path]);
...@@ -555,7 +555,7 @@ void main() { ...@@ -555,7 +555,7 @@ void main() {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
expect( expect(
runner.run(<String>['create', projectDir.path, '--pub']), runner.run(<String>['create', projectDir.path, '--pub']),
...@@ -567,7 +567,7 @@ void main() { ...@@ -567,7 +567,7 @@ void main() {
testUsingContext('fails when file exists', () async { testUsingContext('fails when file exists', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
final File existingFile = fs.file('${projectDir.path.toString()}/bad'); final File existingFile = fs.file('${projectDir.path.toString()}/bad');
if (!existingFile.existsSync()) { if (!existingFile.existsSync()) {
existingFile.createSync(recursive: true); existingFile.createSync(recursive: true);
...@@ -581,7 +581,7 @@ void main() { ...@@ -581,7 +581,7 @@ void main() {
testUsingContext('fails when invalid package name', () async { testUsingContext('fails when invalid package name', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
expect( expect(
runner.run(<String>['create', fs.path.join(projectDir.path, 'invalidName')]), runner.run(<String>['create', fs.path.join(projectDir.path, 'invalidName')]),
throwsToolExit(message: '"invalidName" is not a valid Dart package name.'), throwsToolExit(message: '"invalidName" is not a valid Dart package name.'),
...@@ -594,7 +594,7 @@ void main() { ...@@ -594,7 +594,7 @@ void main() {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--pub', '--offline', projectDir.path]); await runner.run(<String>['create', '--pub', '--offline', projectDir.path]);
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]pub'))); expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]pub')));
...@@ -612,7 +612,7 @@ void main() { ...@@ -612,7 +612,7 @@ void main() {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create', '--pub', projectDir.path]); await runner.run(<String>['create', '--pub', projectDir.path]);
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]pub'))); expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]pub')));
...@@ -625,7 +625,7 @@ void main() { ...@@ -625,7 +625,7 @@ void main() {
); );
} }
Future<Null> _createProject( Future<void> _createProject(
Directory dir, Directory dir,
List<String> createArgs, List<String> createArgs,
List<String> expectedPaths, { List<String> expectedPaths, {
...@@ -633,7 +633,7 @@ Future<Null> _createProject( ...@@ -633,7 +633,7 @@ Future<Null> _createProject(
}) async { }) async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
final List<String> args = <String>['create']; final List<String> args = <String>['create'];
args.addAll(createArgs); args.addAll(createArgs);
args.add(dir.path); args.add(dir.path);
...@@ -658,7 +658,7 @@ Future<Null> _createProject( ...@@ -658,7 +658,7 @@ Future<Null> _createProject(
expect(failures, isEmpty, reason: failures.join('\n')); expect(failures, isEmpty, reason: failures.join('\n'));
} }
Future<Null> _createAndAnalyzeProject( Future<void> _createAndAnalyzeProject(
Directory dir, Directory dir,
List<String> createArgs, List<String> createArgs,
List<String> expectedPaths, { List<String> expectedPaths, {
...@@ -668,7 +668,7 @@ Future<Null> _createAndAnalyzeProject( ...@@ -668,7 +668,7 @@ Future<Null> _createAndAnalyzeProject(
await _analyzeProject(dir.path); await _analyzeProject(dir.path);
} }
Future<Null> _analyzeProject(String workingDir) async { Future<void> _analyzeProject(String workingDir) async {
final String flutterToolsPath = fs.path.absolute(fs.path.join( final String flutterToolsPath = fs.path.absolute(fs.path.join(
'bin', 'bin',
'flutter_tools.dart', 'flutter_tools.dart',
...@@ -691,7 +691,7 @@ Future<Null> _analyzeProject(String workingDir) async { ...@@ -691,7 +691,7 @@ Future<Null> _analyzeProject(String workingDir) async {
expect(exec.exitCode, 0); expect(exec.exitCode, 0);
} }
Future<Null> _runFlutterTest(Directory workingDir, {String target}) async { Future<void> _runFlutterTest(Directory workingDir, {String target}) async {
final String flutterToolsPath = fs.path.absolute(fs.path.join( final String flutterToolsPath = fs.path.absolute(fs.path.join(
'bin', 'bin',
'flutter_tools.dart', 'flutter_tools.dart',
......
...@@ -84,7 +84,7 @@ void main() { ...@@ -84,7 +84,7 @@ void main() {
); );
printStatus('daemon.logMessage test'); printStatus('daemon.logMessage test');
// Service the event loop. // Service the event loop.
await Future<Null>.value(); await Future<void>.value();
}, zoneSpecification: ZoneSpecification(print: (Zone self, ZoneDelegate parent, Zone zone, String line) { }, zoneSpecification: ZoneSpecification(print: (Zone self, ZoneDelegate parent, Zone zone, String line) {
buffer.writeln(line); buffer.writeln(line);
})); }));
...@@ -103,7 +103,7 @@ void main() { ...@@ -103,7 +103,7 @@ void main() {
notifyingLogger: notifyingLogger notifyingLogger: notifyingLogger
); );
commands.add(<String, dynamic>{'id': 0, 'method': 'daemon.shutdown'}); commands.add(<String, dynamic>{'id': 0, 'method': 'daemon.shutdown'});
return daemon.onExit.then<Null>((int code) async { return daemon.onExit.then<void>((int code) async {
await commands.close(); await commands.close();
expect(code, 0); expect(code, 0);
}); });
......
...@@ -31,7 +31,7 @@ void main() { ...@@ -31,7 +31,7 @@ void main() {
srcFile.writeAsStringSync(original.replaceFirst('main()', 'main( )')); srcFile.writeAsStringSync(original.replaceFirst('main()', 'main( )'));
final FormatCommand command = FormatCommand(); final FormatCommand command = FormatCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['format', srcFile.path]); await runner.run(<String>['format', srcFile.path]);
final String formatted = srcFile.readAsStringSync(); final String formatted = srcFile.readAsStringSync();
...@@ -48,7 +48,7 @@ void main() { ...@@ -48,7 +48,7 @@ void main() {
srcFile.writeAsStringSync(nonFormatted); srcFile.writeAsStringSync(nonFormatted);
final FormatCommand command = FormatCommand(); final FormatCommand command = FormatCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['format', '--dry-run', srcFile.path]); await runner.run(<String>['format', '--dry-run', srcFile.path]);
final String shouldNotFormatted = srcFile.readAsStringSync(); final String shouldNotFormatted = srcFile.readAsStringSync();
...@@ -65,7 +65,7 @@ void main() { ...@@ -65,7 +65,7 @@ void main() {
srcFile.writeAsStringSync(nonFormatted); srcFile.writeAsStringSync(nonFormatted);
final FormatCommand command = FormatCommand(); final FormatCommand command = FormatCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
expect(runner.run(<String>[ expect(runner.run(<String>[
'format', '--dry-run', '--set-exit-if-changed', srcFile.path 'format', '--dry-run', '--set-exit-if-changed', srcFile.path
......
...@@ -76,7 +76,7 @@ void main() { ...@@ -76,7 +76,7 @@ void main() {
return fs.file(absPath).existsSync() || fs.directory(absPath).existsSync(); return fs.file(absPath).existsSync() || fs.directory(absPath).existsSync();
} }
Future<Null> _updateIdeConfig({ Future<void> _updateIdeConfig({
Directory dir, Directory dir,
List<String> args = const <String>[], List<String> args = const <String>[],
Map<String, String> expectedContents = const <String, String>{}, Map<String, String> expectedContents = const <String, String>{},
...@@ -84,7 +84,7 @@ void main() { ...@@ -84,7 +84,7 @@ void main() {
}) async { }) async {
dir ??= tempDir; dir ??= tempDir;
final IdeConfigCommand command = IdeConfigCommand(); final IdeConfigCommand command = IdeConfigCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
final List<String> finalArgs = <String>['--flutter-root=${tempDir.absolute.path}', 'ide-config']; final List<String> finalArgs = <String>['--flutter-root=${tempDir.absolute.path}', 'ide-config'];
finalArgs.addAll(args); finalArgs.addAll(args);
await runner.run(finalArgs); await runner.run(finalArgs);
......
...@@ -57,9 +57,9 @@ void main() { ...@@ -57,9 +57,9 @@ void main() {
return projectPath; return projectPath;
} }
Future<Null> runCommandIn(String projectPath, String verb, { List<String> args }) async { Future<void> runCommandIn(String projectPath, String verb, { List<String> args }) async {
final PackagesCommand command = PackagesCommand(); final PackagesCommand command = PackagesCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
final List<String> commandArgs = <String>['packages', verb]; final List<String> commandArgs = <String>['packages', verb];
if (args != null) if (args != null)
...@@ -307,12 +307,12 @@ void main() { ...@@ -307,12 +307,12 @@ void main() {
testUsingContext('publish', () async { testUsingContext('publish', () async {
final PromptingProcess process = PromptingProcess(); final PromptingProcess process = PromptingProcess();
mockProcessManager.processFactory = (List<String> commands) => process; mockProcessManager.processFactory = (List<String> commands) => process;
final Future<Null> runPackages = createTestCommandRunner(PackagesCommand()).run(<String>['packages', 'pub', 'publish']); final Future<void> runPackages = createTestCommandRunner(PackagesCommand()).run(<String>['packages', 'pub', 'publish']);
final Future<Null> runPrompt = process.showPrompt('Proceed (y/n)? ', <String>['hello', 'world']); final Future<void> runPrompt = process.showPrompt('Proceed (y/n)? ', <String>['hello', 'world']);
final Future<Null> simulateUserInput = Future<Null>(() { final Future<void> simulateUserInput = Future<void>(() {
mockStdio.simulateStdin('y'); mockStdio.simulateStdin('y');
}); });
await Future.wait<Null>(<Future<Null>>[runPackages, runPrompt, simulateUserInput]); await Future.wait<void>(<Future<void>>[runPackages, runPrompt, simulateUserInput]);
final List<String> commands = mockProcessManager.commands; final List<String> commands = mockProcessManager.commands;
expect(commands, hasLength(2)); expect(commands, hasLength(2));
expect(commands[0], matches(r'dart-sdk[\\/]bin[\\/]pub')); expect(commands[0], matches(r'dart-sdk[\\/]bin[\\/]pub'));
......
...@@ -15,7 +15,7 @@ import '../src/context.dart'; ...@@ -15,7 +15,7 @@ import '../src/context.dart';
// This test depends on some files in ///dev/automated_tests/flutter_test/* // This test depends on some files in ///dev/automated_tests/flutter_test/*
Future<Null> _testExclusionLock; Future<void> _testExclusionLock;
void main() { void main() {
group('flutter test should', () { group('flutter test should', () {
...@@ -90,7 +90,7 @@ void main() { ...@@ -90,7 +90,7 @@ void main() {
}); });
} }
Future<Null> _testFile(String testName, String workingDirectory, String testDirectory, {Matcher exitCode}) async { Future<void> _testFile(String testName, String workingDirectory, String testDirectory, {Matcher exitCode}) async {
exitCode ??= isNonZero; exitCode ??= isNonZero;
final String fullTestExpectation = fs.path.join(testDirectory, '${testName}_expectation.txt'); final String fullTestExpectation = fs.path.join(testDirectory, '${testName}_expectation.txt');
final File expectationFile = fs.file(fullTestExpectation); final File expectationFile = fs.file(fullTestExpectation);
...@@ -171,7 +171,7 @@ Future<ProcessResult> _runFlutterTest( ...@@ -171,7 +171,7 @@ Future<ProcessResult> _runFlutterTest(
while (_testExclusionLock != null) while (_testExclusionLock != null)
await _testExclusionLock; await _testExclusionLock;
final Completer<Null> testExclusionCompleter = Completer<Null>(); final Completer<void> testExclusionCompleter = Completer<void>();
_testExclusionLock = testExclusionCompleter.future; _testExclusionLock = testExclusionCompleter.future;
try { try {
return await Process.run( return await Process.run(
......
...@@ -376,7 +376,7 @@ void main() { ...@@ -376,7 +376,7 @@ void main() {
}); });
} }
Future<Null> _recompile(StreamController<List<int>> streamController, Future<void> _recompile(StreamController<List<int>> streamController,
ResidentCompiler generator, MockStdIn mockFrontendServerStdIn, ResidentCompiler generator, MockStdIn mockFrontendServerStdIn,
String mockCompilerOutput) async { String mockCompilerOutput) async {
// Put content into the output stream after generator.recompile gets // Put content into the output stream after generator.recompile gets
......
...@@ -173,7 +173,7 @@ class _CrashCommand extends FlutterCommand { ...@@ -173,7 +173,7 @@ class _CrashCommand extends FlutterCommand {
String get name => 'crash'; String get name => 'crash';
@override @override
Future<Null> runCommand() async { Future<FlutterCommandResult> runCommand() async {
void fn1() { void fn1() {
throw StateError('Test bad state error'); throw StateError('Test bad state error');
} }
...@@ -187,6 +187,8 @@ class _CrashCommand extends FlutterCommand { ...@@ -187,6 +187,8 @@ class _CrashCommand extends FlutterCommand {
} }
fn3(); fn3();
return null;
} }
} }
......
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
FakeAsync().run((FakeAsync time) { FakeAsync().run((FakeAsync time) {
expect(processMock.lastPubEnvironment, isNull); expect(processMock.lastPubEnvironment, isNull);
expect(testLogger.statusText, ''); expect(testLogger.statusText, '');
pubGet(context: PubContext.flutterTests, checkLastModified: false).then((Null value) { pubGet(context: PubContext.flutterTests, checkLastModified: false).then((void value) {
error = 'test completed unexpectedly'; error = 'test completed unexpectedly';
}, onError: (dynamic thrownError) { }, onError: (dynamic thrownError) {
error = 'test failed unexpectedly: $thrownError'; error = 'test failed unexpectedly: $thrownError';
...@@ -102,7 +102,7 @@ void main() { ...@@ -102,7 +102,7 @@ void main() {
MockDirectory.findCache = true; MockDirectory.findCache = true;
expect(processMock.lastPubEnvironment, isNull); expect(processMock.lastPubEnvironment, isNull);
expect(processMock.lastPubCache, isNull); expect(processMock.lastPubCache, isNull);
pubGet(context: PubContext.flutterTests, checkLastModified: false).then((Null value) { pubGet(context: PubContext.flutterTests, checkLastModified: false).then((void value) {
error = 'test completed unexpectedly'; error = 'test completed unexpectedly';
}, onError: (dynamic thrownError) { }, onError: (dynamic thrownError) {
error = 'test failed unexpectedly: $thrownError'; error = 'test failed unexpectedly: $thrownError';
...@@ -128,7 +128,7 @@ void main() { ...@@ -128,7 +128,7 @@ void main() {
MockDirectory.findCache = true; MockDirectory.findCache = true;
expect(processMock.lastPubEnvironment, isNull); expect(processMock.lastPubEnvironment, isNull);
expect(processMock.lastPubCache, isNull); expect(processMock.lastPubCache, isNull);
pubGet(context: PubContext.flutterTests, checkLastModified: false).then((Null value) { pubGet(context: PubContext.flutterTests, checkLastModified: false).then((void value) {
error = 'test completed unexpectedly'; error = 'test completed unexpectedly';
}, onError: (dynamic thrownError) { }, onError: (dynamic thrownError) {
error = 'test failed unexpectedly: $thrownError'; error = 'test failed unexpectedly: $thrownError';
...@@ -213,7 +213,7 @@ class MockStreamSubscription<T> implements StreamSubscription<T> { ...@@ -213,7 +213,7 @@ class MockStreamSubscription<T> implements StreamSubscription<T> {
Future<E> asFuture<E>([E futureValue]) => Future<E>.value(); Future<E> asFuture<E>([E futureValue]) => Future<E>.value();
@override @override
Future<Null> cancel() => null; Future<void> cancel() => null;
@override @override
dynamic noSuchMethod(Invocation invocation) => null; dynamic noSuchMethod(Invocation invocation) => null;
......
...@@ -438,7 +438,7 @@ class MockVMService extends BasicMock implements VMService { ...@@ -438,7 +438,7 @@ class MockVMService extends BasicMock implements VMService {
@override @override
VM get vm => _vm; VM get vm => _vm;
Future<Null> setUp() async { Future<void> setUp() async {
try { try {
_server = await HttpServer.bind(InternetAddress.loopbackIPv6, 0); _server = await HttpServer.bind(InternetAddress.loopbackIPv6, 0);
_httpAddress = Uri.parse('http://[::1]:${_server.port}'); _httpAddress = Uri.parse('http://[::1]:${_server.port}');
...@@ -451,7 +451,7 @@ class MockVMService extends BasicMock implements VMService { ...@@ -451,7 +451,7 @@ class MockVMService extends BasicMock implements VMService {
final String fsName = request.headers.value('dev_fs_name'); final String fsName = request.headers.value('dev_fs_name');
final String devicePath = utf8.decode(base64.decode(request.headers.value('dev_fs_uri_b64'))); final String devicePath = utf8.decode(base64.decode(request.headers.value('dev_fs_uri_b64')));
messages.add('writeFile $fsName $devicePath'); messages.add('writeFile $fsName $devicePath');
request.drain<List<int>>().then<Null>((List<int> value) { request.drain<List<int>>().then<void>((List<int> value) {
request.response request.response
..write('Got it') ..write('Got it')
..close(); ..close();
...@@ -459,7 +459,7 @@ class MockVMService extends BasicMock implements VMService { ...@@ -459,7 +459,7 @@ class MockVMService extends BasicMock implements VMService {
}); });
} }
Future<Null> tearDown() async { Future<void> tearDown() async {
await _server?.close(); await _server?.close();
} }
...@@ -522,7 +522,7 @@ void _cleanupTempDirs() { ...@@ -522,7 +522,7 @@ void _cleanupTempDirs() {
tryToDelete(_tempDirs.removeLast()); tryToDelete(_tempDirs.removeLast());
} }
Future<Null> _createPackage(FileSystem fs, String pkgName, String pkgFileName, { bool doubleSlash = false }) async { Future<void> _createPackage(FileSystem fs, String pkgName, String pkgFileName, { bool doubleSlash = false }) async {
final Directory pkgTempDir = _newTempDir(fs); final Directory pkgTempDir = _newTempDir(fs);
String pkgFilePath = fs.path.join(pkgTempDir.path, pkgName, 'lib', pkgFileName); String pkgFilePath = fs.path.join(pkgTempDir.path, pkgName, 'lib', pkgFileName);
if (doubleSlash) { if (doubleSlash) {
......
...@@ -25,7 +25,7 @@ void main() { ...@@ -25,7 +25,7 @@ void main() {
final List<Device> devices = <Device>[device1, device2, device3]; final List<Device> devices = <Device>[device1, device2, device3];
final DeviceManager deviceManager = TestDeviceManager(devices); final DeviceManager deviceManager = TestDeviceManager(devices);
Future<Null> expectDevice(String id, List<Device> expected) async { Future<void> expectDevice(String id, List<Device> expected) async {
expect(await deviceManager.getDevicesById(id).toList(), expected); expect(await deviceManager.getDevicesById(id).toList(), expected);
} }
await expectDevice('01abfc49119c410e', <Device>[device2]); await expectDevice('01abfc49119c410e', <Device>[device2]);
......
...@@ -58,7 +58,7 @@ void main() { ...@@ -58,7 +58,7 @@ void main() {
final TestEmulatorManager testEmulatorManager = final TestEmulatorManager testEmulatorManager =
TestEmulatorManager(emulators); TestEmulatorManager(emulators);
Future<Null> expectEmulator(String id, List<Emulator> expected) async { Future<void> expectEmulator(String id, List<Emulator> expected) async {
expect(await testEmulatorManager.getEmulatorsMatching(id), expected); expect(await testEmulatorManager.getEmulatorsMatching(id), expected);
} }
......
...@@ -234,7 +234,7 @@ void main() { ...@@ -234,7 +234,7 @@ void main() {
mockXcodeProjectInterpreter = MockXcodeProjectInterpreter(); mockXcodeProjectInterpreter = MockXcodeProjectInterpreter();
}); });
void testWithMocks(String description, Future<Null> testMethod()) { void testWithMocks(String description, Future<void> testMethod()) {
testUsingContext(description, testMethod, overrides: <Type, Generator>{ testUsingContext(description, testMethod, overrides: <Type, Generator>{
FileSystem: () => fs, FileSystem: () => fs,
IOSWorkflow: () => mockIOSWorkflow, IOSWorkflow: () => mockIOSWorkflow,
...@@ -365,7 +365,7 @@ flutter: ...@@ -365,7 +365,7 @@ flutter:
/// Executes the [testMethod] in a context where the file system /// Executes the [testMethod] in a context where the file system
/// is in memory. /// is in memory.
void testInMemory(String description, Future<Null> testMethod()) { void testInMemory(String description, Future<void> testMethod()) {
Cache.flutterRoot = getFlutterRoot(); Cache.flutterRoot = getFlutterRoot();
final FileSystem testFileSystem = MemoryFileSystem( final FileSystem testFileSystem = MemoryFileSystem(
style: platform.isWindows ? FileSystemStyle.windows : FileSystemStyle.posix, style: platform.isWindows ? FileSystemStyle.windows : FileSystemStyle.posix,
...@@ -406,7 +406,7 @@ void transfer(FileSystemEntity entity, FileSystem target) { ...@@ -406,7 +406,7 @@ void transfer(FileSystemEntity entity, FileSystem target) {
} }
} }
Future<Null> expectToolExitLater(Future<dynamic> future, Matcher messageMatcher) async { Future<void> expectToolExitLater(Future<dynamic> future, Matcher messageMatcher) async {
try { try {
await future; await future;
fail('ToolExit expected, but nothing thrown'); fail('ToolExit expected, but nothing thrown');
......
...@@ -240,7 +240,7 @@ class MockPortForwarder extends DevicePortForwarder { ...@@ -240,7 +240,7 @@ class MockPortForwarder extends DevicePortForwarder {
List<ForwardedPort> get forwardedPorts => throw 'not implemented'; List<ForwardedPort> get forwardedPorts => throw 'not implemented';
@override @override
Future<Null> unforward(ForwardedPort forwardedPort) { Future<void> unforward(ForwardedPort forwardedPort) {
throw 'not implemented'; throw 'not implemented';
} }
} }
...@@ -18,13 +18,13 @@ class TestRunner extends ResidentRunner { ...@@ -18,13 +18,13 @@ class TestRunner extends ResidentRunner {
String receivedCommand; String receivedCommand;
@override @override
Future<Null> cleanupAfterSignal() => null; Future<void> cleanupAfterSignal() => null;
@override @override
Future<Null> cleanupAtFinish() => null; Future<void> cleanupAtFinish() => null;
@override @override
Future<Null> handleTerminalCommand(String code) async { Future<void> handleTerminalCommand(String code) async {
receivedCommand = code; receivedCommand = code;
} }
......
...@@ -188,7 +188,7 @@ class DummyFlutterCommand extends FlutterCommand { ...@@ -188,7 +188,7 @@ class DummyFlutterCommand extends FlutterCommand {
@override @override
Future<FlutterCommandResult> runCommand() async { Future<FlutterCommandResult> runCommand() async {
return commandFunction == null ? null : commandFunction(); return commandFunction == null ? null : await commandFunction();
} }
} }
......
...@@ -68,7 +68,7 @@ String getFlutterRoot() { ...@@ -68,7 +68,7 @@ String getFlutterRoot() {
return fs.path.normalize(fs.path.join(toolsPath, '..', '..')); return fs.path.normalize(fs.path.join(toolsPath, '..', '..'));
} }
CommandRunner<Null> createTestCommandRunner([FlutterCommand command]) { CommandRunner<void> createTestCommandRunner([FlutterCommand command]) {
final FlutterCommandRunner runner = FlutterCommandRunner(); final FlutterCommandRunner runner = FlutterCommandRunner();
if (command != null) if (command != null)
runner.addCommand(command); runner.addCommand(command);
...@@ -113,7 +113,7 @@ Future<String> createProject(Directory temp, {List<String> arguments}) async { ...@@ -113,7 +113,7 @@ Future<String> createProject(Directory temp, {List<String> arguments}) async {
arguments ??= <String>['--no-pub']; arguments ??= <String>['--no-pub'];
final String projectPath = fs.path.join(temp.path, 'flutter_project'); final String projectPath = fs.path.join(temp.path, 'flutter_project');
final CreateCommand command = CreateCommand(); final CreateCommand command = CreateCommand();
final CommandRunner<Null> runner = createTestCommandRunner(command); final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>['create']..addAll(arguments)..add(projectPath)); await runner.run(<String>['create']..addAll(arguments)..add(projectPath));
return projectPath; return projectPath;
} }
......
...@@ -262,7 +262,7 @@ class MockUsage implements Usage { ...@@ -262,7 +262,7 @@ class MockUsage implements Usage {
Stream<Map<String, dynamic>> get onSend => null; Stream<Map<String, dynamic>> get onSend => null;
@override @override
Future<Null> ensureAnalyticsSent() => Future<Null>.value(); Future<void> ensureAnalyticsSent() => Future<void>.value();
@override @override
void printWelcome() { } void printWelcome() { }
......
...@@ -173,7 +173,7 @@ class MockProcess extends Mock implements Process { ...@@ -173,7 +173,7 @@ class MockProcess extends Mock implements Process {
/// A process that prompts the user to proceed, then asynchronously writes /// A process that prompts the user to proceed, then asynchronously writes
/// some lines to stdout before it exits. /// some lines to stdout before it exits.
class PromptingProcess implements Process { class PromptingProcess implements Process {
Future<Null> showPrompt(String prompt, List<String> outputLines) async { Future<void> showPrompt(String prompt, List<String> outputLines) async {
_stdoutController.add(utf8.encode(prompt)); _stdoutController.add(utf8.encode(prompt));
final List<int> bytesOnStdin = await _stdin.future; final List<int> bytesOnStdin = await _stdin.future;
// Echo stdin to stdout. // Echo stdin to stdout.
...@@ -234,11 +234,11 @@ class MemoryIOSink implements IOSink { ...@@ -234,11 +234,11 @@ class MemoryIOSink implements IOSink {
} }
@override @override
Future<Null> addStream(Stream<List<int>> stream) { Future<void> addStream(Stream<List<int>> stream) {
final Completer<Null> completer = Completer<Null>(); final Completer<void> completer = Completer<void>();
stream.listen((List<int> data) { stream.listen((List<int> data) {
add(data); add(data);
}).onDone(() => completer.complete(null)); }).onDone(() => completer.complete());
return completer.future; return completer.future;
} }
...@@ -275,13 +275,13 @@ class MemoryIOSink implements IOSink { ...@@ -275,13 +275,13 @@ class MemoryIOSink implements IOSink {
} }
@override @override
Future<Null> get done => close(); Future<void> get done => close();
@override @override
Future<Null> close() async => null; Future<void> close() async => null;
@override @override
Future<Null> flush() async => null; Future<void> flush() async => null;
} }
/// A Stdio that collects stdout and supports simulated stdin. /// A Stdio that collects stdout and supports simulated stdin.
......
...@@ -134,7 +134,7 @@ baz=qux ...@@ -134,7 +134,7 @@ baz=qux
called = true; called = true;
}, const Duration(seconds: 1)); }, const Duration(seconds: 1));
expect(called, false); expect(called, false);
await Future<Null>.delayed(kShortDelay); await Future<void>.delayed(kShortDelay);
expect(called, true); expect(called, true);
}); });
...@@ -145,7 +145,7 @@ baz=qux ...@@ -145,7 +145,7 @@ baz=qux
callCount++; callCount++;
}, Duration(milliseconds: kShortDelay.inMilliseconds ~/ 2)); }, Duration(milliseconds: kShortDelay.inMilliseconds ~/ 2));
expect(callCount, 0); expect(callCount, 0);
await Future<Null>.delayed(kShortDelay); await Future<void>.delayed(kShortDelay);
expect(callCount, greaterThanOrEqualTo(2)); expect(callCount, greaterThanOrEqualTo(2));
}); });
...@@ -160,7 +160,7 @@ baz=qux ...@@ -160,7 +160,7 @@ baz=qux
completer.complete(DateTime.now().difference(firstTime)); completer.complete(DateTime.now().difference(firstTime));
// introduce a delay // introduce a delay
await Future<Null>.delayed(kShortDelay); await Future<void>.delayed(kShortDelay);
}, kShortDelay); }, kShortDelay);
final Duration duration = await completer.future; final Duration duration = await completer.future;
expect(duration, greaterThanOrEqualTo(Duration(milliseconds: kShortDelay.inMilliseconds * 2))); expect(duration, greaterThanOrEqualTo(Duration(milliseconds: kShortDelay.inMilliseconds * 2)));
......
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