Increase the strictness of our requiring explicit types (#7585)
...now that we have generic methods, their types need to be specified too.
This commit is contained in:
@@ -162,7 +162,7 @@ Future<Null> main(List<String> args) async {
|
||||
else
|
||||
stderr.writeln('Oops; flutter has exited unexpectedly.');
|
||||
|
||||
_createCrashReport(args, error, chain).then((File file) {
|
||||
_createCrashReport(args, error, chain).then<Null>((File file) {
|
||||
stderr.writeln(
|
||||
'Crash report written to ${file.path};\n'
|
||||
'please let us know at https://github.com/flutter/flutter/issues.'
|
||||
|
||||
@@ -587,12 +587,11 @@ class _AdbLogReader extends DeviceLogReader {
|
||||
_timeOrigin = _adbTimestampToDateTime(lastTimestamp);
|
||||
else
|
||||
_timeOrigin = null;
|
||||
runCommand(device.adbCommandForDevice(args)).then((Process process) {
|
||||
runCommand(device.adbCommandForDevice(args)).then<Null>((Process process) {
|
||||
_process = process;
|
||||
_process.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
_process.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
|
||||
_process.exitCode.then((int code) {
|
||||
_process.exitCode.whenComplete(() {
|
||||
if (_linesController.hasListener)
|
||||
_linesController.close();
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ Future<int> runCommandAndStreamOutput(List<String> cmd, {
|
||||
|
||||
// Wait for stdout to be fully processed
|
||||
// because process.exitCode may complete first causing flaky tests.
|
||||
await subscription.asFuture();
|
||||
await subscription.asFuture<Null>();
|
||||
subscription.cancel();
|
||||
|
||||
return await process.exitCode;
|
||||
|
||||
@@ -410,13 +410,14 @@ class RecordingProcessManager implements ProcessManager {
|
||||
await files.forEach((FileSystemEntity entity) {
|
||||
File file = entity;
|
||||
Future<dynamic> readAsBytes = file.readAsBytes();
|
||||
addAllFilesToArchive.add(readAsBytes.then((List<int> data) {
|
||||
addAllFilesToArchive.add(readAsBytes.then<Null>((List<int> data) {
|
||||
archive.addFile(new ArchiveFile.noCompress(
|
||||
path.basename(file.path), data.length, data));
|
||||
path.basename(file.path), data.length, data)
|
||||
);
|
||||
}));
|
||||
});
|
||||
|
||||
await Future.wait(addAllFilesToArchive);
|
||||
await Future.wait<dynamic>(addAllFilesToArchive);
|
||||
return new ZipEncoder().encode(archive);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ class MaterialFonts {
|
||||
|
||||
return Cache._downloadFileToCache(
|
||||
Uri.parse(cache.getVersionFor(kName)), fontsDir, true
|
||||
).then((_) {
|
||||
).then<Null>((Null value) {
|
||||
cache.setStampFor(kName, cache.getVersionFor(kName));
|
||||
status.stop();
|
||||
}).whenComplete(() {
|
||||
@@ -401,7 +401,7 @@ class FlutterEngine {
|
||||
|
||||
Future<Null> _downloadItem(String message, String url, Directory dest) {
|
||||
Status status = logger.startProgress(message);
|
||||
return Cache._downloadFileToCache(Uri.parse(url), dest, true).then((_) {
|
||||
return Cache._downloadFileToCache(Uri.parse(url), dest, true).then<Null>((Null value) {
|
||||
status.stop();
|
||||
}).whenComplete(() {
|
||||
status.cancel();
|
||||
|
||||
@@ -120,7 +120,7 @@ class AnalyzeContinuously extends AnalyzeBase {
|
||||
|
||||
if (firstAnalysis && isBenchmarking) {
|
||||
writeBenchmark(analysisTimer, issueCount, -1); // TODO(ianh): track members missing dartdocs instead of saying -1
|
||||
server.dispose().then((_) => exit(issueCount > 0 ? 1 : 0));
|
||||
server.dispose().whenComplete(() { exit(issueCount > 0 ? 1 : 0); });
|
||||
}
|
||||
|
||||
firstAnalysis = false;
|
||||
|
||||
@@ -171,7 +171,7 @@ abstract class Domain {
|
||||
if (_handlers.containsKey(command))
|
||||
return _handlers[command](args);
|
||||
throw 'command not understood: $name.$command';
|
||||
}).then((dynamic result) {
|
||||
}).then<Null>((dynamic result) {
|
||||
if (result == null) {
|
||||
_send(<String, dynamic>{'id': id});
|
||||
} else {
|
||||
@@ -386,7 +386,7 @@ class AppDomain extends Domain {
|
||||
|
||||
if (options.debuggingEnabled) {
|
||||
connectionInfoCompleter = new Completer<DebugConnectionInfo>();
|
||||
connectionInfoCompleter.future.then((DebugConnectionInfo info) {
|
||||
connectionInfoCompleter.future.then<Null>((DebugConnectionInfo info) {
|
||||
Map<String, dynamic> params = <String, dynamic>{
|
||||
'port': info.httpUri.port,
|
||||
'wsUri': info.wsUri.toString(),
|
||||
@@ -397,7 +397,7 @@ class AppDomain extends Domain {
|
||||
});
|
||||
}
|
||||
Completer<Null> appStartedCompleter = new Completer<Null>();
|
||||
appStartedCompleter.future.then((_) {
|
||||
appStartedCompleter.future.then<Null>((Null value) {
|
||||
_sendAppEvent(app, 'started');
|
||||
});
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ class _DevFSHttpWriter {
|
||||
Stream<List<int>> contents = content.contentsAsCompressedStream();
|
||||
await request.addStream(contents);
|
||||
HttpClientResponse response = await request.close();
|
||||
await response.drain();
|
||||
await response.drain<Null>();
|
||||
} catch (e) {
|
||||
printError('Error writing "$devicePath" to DevFS: $e');
|
||||
}
|
||||
@@ -417,7 +417,10 @@ class DevFS {
|
||||
if (progressReporter != null) {
|
||||
final int max = _pendingOperations.length;
|
||||
int complete = 0;
|
||||
_pendingOperations.forEach((Future<dynamic> f) => f.then((dynamic v) {
|
||||
_pendingOperations.forEach((Future<dynamic> f) => f.whenComplete(() {
|
||||
// TODO(ianh): If one of the pending operations fail, we'll keep
|
||||
// calling progressReporter long after update() has completed its
|
||||
// future, assuming that doesn't crash the app.
|
||||
complete += 1;
|
||||
progressReporter(complete, max);
|
||||
}));
|
||||
|
||||
@@ -402,12 +402,11 @@ class _IOSDeviceLogReader extends DeviceLogReader {
|
||||
String get name => device.name;
|
||||
|
||||
void _start() {
|
||||
runCommand(<String>[device.loggerPath]).then((Process process) {
|
||||
runCommand(<String>[device.loggerPath]).then<Null>((Process process) {
|
||||
_process = process;
|
||||
_process.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
_process.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onLine);
|
||||
|
||||
_process.exitCode.then((int code) {
|
||||
_process.exitCode.whenComplete(() {
|
||||
if (_linesController.hasListener)
|
||||
_linesController.close();
|
||||
});
|
||||
|
||||
@@ -663,7 +663,7 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
|
||||
_systemProcess.stdout.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onSystemLine);
|
||||
_systemProcess.stderr.transform(UTF8.decoder).transform(const LineSplitter()).listen(_onSystemLine);
|
||||
|
||||
_deviceProcess.exitCode.then((int code) {
|
||||
_deviceProcess.exitCode.whenComplete(() {
|
||||
if (_linesController.hasListener)
|
||||
_linesController.close();
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ class CoverageCollector {
|
||||
|
||||
int pid = process.pid;
|
||||
int exitCode;
|
||||
process.exitCode.then((int code) {
|
||||
process.exitCode.then<Null>((int code) {
|
||||
exitCode = code;
|
||||
});
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
bool subprocessActive = false;
|
||||
bool controllerSinkClosed = false;
|
||||
try {
|
||||
controller.sink.done.then((_) { controllerSinkClosed = true; });
|
||||
controller.sink.done.whenComplete(() { controllerSinkClosed = true; });
|
||||
|
||||
// Prepare our WebSocket server to talk to the engine subproces.
|
||||
HttpServer server = await HttpServer.bind(_kHost, 0);
|
||||
@@ -524,10 +524,10 @@ class _FlutterPlatformStreamSinkWrapper<S> implements StreamSink<S> {
|
||||
|
||||
@override
|
||||
Future<dynamic> close() {
|
||||
Future.wait(<Future<dynamic>>[
|
||||
Future.wait<dynamic>(<Future<dynamic>>[
|
||||
_parent.close(),
|
||||
_shellProcessClosed,
|
||||
]).then(
|
||||
]).then<Null>(
|
||||
(List<dynamic> value) {
|
||||
_done.complete();
|
||||
},
|
||||
|
||||
@@ -561,7 +561,7 @@ class VM extends ServiceObjectOwner {
|
||||
Future<Isolate> getIsolate(String isolateId) {
|
||||
if (!loaded) {
|
||||
// Trigger a VM load, then get the isolate. Ignore any errors.
|
||||
return load().then((_) => getIsolate(isolateId)).catchError((_) => null);
|
||||
return load().then<Isolate>((ServiceObject serviceObject) => getIsolate(isolateId)).catchError((dynamic error) => null);
|
||||
}
|
||||
return new Future<Isolate>.value(_isolateCache[isolateId]);
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ class _ArchiveZipBuilder extends ZipBuilder {
|
||||
final Completer<Null> finished = new Completer<Null>();
|
||||
int count = entries.length;
|
||||
entries.forEach((String archivePath, DevFSContent content) {
|
||||
content.contentsAsBytes().then((List<int> data) {
|
||||
content.contentsAsBytes().then<Null>((List<int> data) {
|
||||
archive.addFile(new ArchiveFile.noCompress(archivePath, data.length, data));
|
||||
--count;
|
||||
count -= 1;
|
||||
if (count == 0)
|
||||
finished.complete();
|
||||
});
|
||||
@@ -73,11 +73,11 @@ class _ZipToolBuilder extends ZipBuilder {
|
||||
final Completer<Null> finished = new Completer<Null>();
|
||||
int count = entries.length;
|
||||
entries.forEach((String archivePath, DevFSContent content) {
|
||||
content.contentsAsBytes().then((List<int> data) {
|
||||
content.contentsAsBytes().then<Null>((List<int> data) {
|
||||
File file = fs.file(path.join(zipBuildDir.path, archivePath));
|
||||
file.parent.createSync(recursive: true);
|
||||
file.writeAsBytes(data).then((_) {
|
||||
--count;
|
||||
file.writeAsBytes(data).then<Null>((File value) {
|
||||
count -= 1;
|
||||
if (count == 0)
|
||||
finished.complete();
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ void main() {
|
||||
applyMocksToCommand(command);
|
||||
return createTestCommandRunner(command).run(
|
||||
<String>['analyze', '--no-current-package', '--no-current-directory', dartFileA.path, dartFileB.path]
|
||||
).then((_) {
|
||||
).then<Null>((Null value) {
|
||||
expect(testLogger.statusText, startsWith('Analyzing 2 files...\nNo analyzer warnings!'));
|
||||
});
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ void main() {
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
commands.add(<String, dynamic>{'id': 0, 'method': 'daemon.shutdown'});
|
||||
return daemon.onExit.then((int code) {
|
||||
return daemon.onExit.then<Null>((int code) {
|
||||
responses.close();
|
||||
commands.close();
|
||||
expect(code, 0);
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
analyzer:
|
||||
exclude:
|
||||
exclude:
|
||||
- '**'
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
analyzer:
|
||||
exclude:
|
||||
exclude:
|
||||
- '**'
|
||||
|
||||
@@ -268,7 +268,7 @@ class MockVMService extends BasicMock implements VMService {
|
||||
String fsName = request.headers.value('dev_fs_name');
|
||||
String devicePath = UTF8.decode(BASE64.decode(request.headers.value('dev_fs_path_b64')));
|
||||
messages.add('writeFile $fsName $devicePath');
|
||||
request.drain().then((_) {
|
||||
request.drain<List<int>>().then<Null>((List<int> value) {
|
||||
request.response
|
||||
..write('Got it')
|
||||
..close();
|
||||
|
||||
@@ -47,13 +47,13 @@ void main() {
|
||||
targetDeviceFinder = () {
|
||||
throw 'Unexpected call to targetDeviceFinder';
|
||||
};
|
||||
appStarter = (_) {
|
||||
appStarter = (DriveCommand command) {
|
||||
throw 'Unexpected call to appStarter';
|
||||
};
|
||||
testRunner = (_) {
|
||||
testRunner = (List<String> testArgs) {
|
||||
throw 'Unexpected call to testRunner';
|
||||
};
|
||||
appStopper = (_) {
|
||||
appStopper = (DriveCommand command) {
|
||||
throw 'Unexpected call to appStopper';
|
||||
};
|
||||
});
|
||||
@@ -86,14 +86,14 @@ void main() {
|
||||
|
||||
testUsingContext('returns 1 when app fails to run', () async {
|
||||
withMockDevice();
|
||||
appStarter = expectAsync((_) async => 1);
|
||||
appStarter = expectAsync((DriveCommand command) async => 1);
|
||||
|
||||
String testApp = '/some/app/test_driver/e2e.dart';
|
||||
String testFile = '/some/app/test_driver/e2e_test.dart';
|
||||
|
||||
MemoryFileSystem memFs = memoryFileSystem;
|
||||
await memFs.file(testApp).writeAsString('main() {}');
|
||||
await memFs.file(testFile).writeAsString('main() {}');
|
||||
await memFs.file(testApp).writeAsString('main() { }');
|
||||
await memFs.file(testFile).writeAsString('main() { }');
|
||||
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
@@ -155,14 +155,14 @@ void main() {
|
||||
String testApp = '/some/app/test/e2e.dart';
|
||||
String testFile = '/some/app/test_driver/e2e_test.dart';
|
||||
|
||||
appStarter = expectAsync((_) {
|
||||
appStarter = expectAsync((DriveCommand command) {
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
testRunner = expectAsync((List<String> testArgs) {
|
||||
expect(testArgs, <String>[testFile]);
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
appStopper = expectAsync((_) {
|
||||
appStopper = expectAsync((DriveCommand command) {
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
|
||||
@@ -186,13 +186,13 @@ void main() {
|
||||
String testApp = '/some/app/test/e2e.dart';
|
||||
String testFile = '/some/app/test_driver/e2e_test.dart';
|
||||
|
||||
appStarter = expectAsync((_) {
|
||||
appStarter = expectAsync((DriveCommand command) {
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
testRunner = (_) {
|
||||
testRunner = (List<String> testArgs) {
|
||||
throwToolExit(null, exitCode: 123);
|
||||
};
|
||||
appStopper = expectAsync((_) {
|
||||
appStopper = expectAsync((DriveCommand command) {
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ Future<Null> main() async {
|
||||
stdout.write('> ');
|
||||
});
|
||||
|
||||
daemon.exitCode.then((int code) {
|
||||
daemon.exitCode.then<Null>((int code) {
|
||||
print('daemon exiting ($code)');
|
||||
exit(code);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user