forked from firka/flutter
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:
@@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user