apply partially the upcoming unnecessary_lambdas (#8810)
This commit is contained in:
committed by
GitHub
parent
f9ad230f15
commit
2166ea5b7f
@@ -74,7 +74,7 @@ export 'dart:io'
|
||||
/// Exits the process with the given [exitCode].
|
||||
typedef void ExitFunction(int exitCode);
|
||||
|
||||
final ExitFunction _defaultExitFunction = (int exitCode) => io.exit(exitCode);
|
||||
final ExitFunction _defaultExitFunction = io.exit;
|
||||
|
||||
ExitFunction _exitFunction = _defaultExitFunction;
|
||||
|
||||
|
||||
@@ -231,9 +231,7 @@ class MaterialFonts {
|
||||
).then<Null>((Null value) {
|
||||
cache.setStampFor(kName, cache.getVersionFor(kName));
|
||||
status.stop();
|
||||
}).whenComplete(() {
|
||||
status.cancel();
|
||||
});
|
||||
}).whenComplete(status.cancel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,8 +374,6 @@ class FlutterEngine {
|
||||
final Status status = logger.startProgress(message, expectSlowOperation: true);
|
||||
return Cache._downloadFileToCache(Uri.parse(url), dest, true).then<Null>((Null value) {
|
||||
status.stop();
|
||||
}).whenComplete(() {
|
||||
status.cancel();
|
||||
});
|
||||
}).whenComplete(status.cancel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class AnalysisServer {
|
||||
_process.exitCode.whenComplete(() => _process = null);
|
||||
|
||||
final Stream<String> errorStream = _process.stderr.transform(UTF8.decoder).transform(const LineSplitter());
|
||||
errorStream.listen((String error) => printError(error));
|
||||
errorStream.listen(printError);
|
||||
|
||||
final Stream<String> inStream = _process.stdout.transform(UTF8.decoder).transform(const LineSplitter());
|
||||
inStream.listen(_handleServerResponse);
|
||||
|
||||
@@ -88,7 +88,7 @@ class Daemon {
|
||||
|
||||
// Start listening.
|
||||
commandStream.listen(
|
||||
(Map<String, dynamic> request) => _handleRequest(request),
|
||||
_handleRequest,
|
||||
onDone: () {
|
||||
if (!_onExitCompleter.isCompleted)
|
||||
_onExitCompleter.complete(0);
|
||||
@@ -264,7 +264,7 @@ class DaemonDomain extends Domain {
|
||||
}
|
||||
|
||||
Future<Null> shutdown(Map<String, dynamic> args) {
|
||||
Timer.run(() => daemon.shutdown());
|
||||
Timer.run(daemon.shutdown);
|
||||
return new Future<Null>.value();
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ abstract class Device {
|
||||
}
|
||||
|
||||
static void printDevices(List<Device> devices) {
|
||||
descriptions(devices).forEach((String msg) => printStatus(msg));
|
||||
descriptions(devices).forEach(printStatus);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -609,9 +609,7 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
|
||||
|
||||
_IOSSimulatorLogReader(this.device, ApplicationPackage app) {
|
||||
_linesController = new StreamController<String>.broadcast(
|
||||
onListen: () {
|
||||
_start();
|
||||
},
|
||||
onListen: _start,
|
||||
onCancel: _stop
|
||||
);
|
||||
_appName = app == null ? null : app.name.replaceAll('.app', '');
|
||||
|
||||
@@ -230,9 +230,7 @@ abstract class ResidentRunner {
|
||||
throwToolExit('No Flutter view is available');
|
||||
|
||||
// Listen for service protocol connection to close.
|
||||
vmService.done.whenComplete(() {
|
||||
appFinished();
|
||||
});
|
||||
vmService.done.whenComplete(appFinished);
|
||||
}
|
||||
|
||||
/// Returns [true] if the input has been handled by this function.
|
||||
@@ -321,9 +319,7 @@ abstract class ResidentRunner {
|
||||
printHelp(details: false);
|
||||
}
|
||||
terminal.singleCharMode = true;
|
||||
terminal.onCharInput.listen((String code) {
|
||||
processTerminalInput(code);
|
||||
});
|
||||
terminal.onCharInput.listen(processTerminalInput);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
|
||||
}
|
||||
|
||||
// The Android SDK could already have been set by tests.
|
||||
context.putIfAbsent(AndroidSdk, () => AndroidSdk.locateAndroidSdk());
|
||||
context.putIfAbsent(AndroidSdk, AndroidSdk.locateAndroidSdk);
|
||||
|
||||
if (globalResults['version']) {
|
||||
flutterUsage.sendCommand('version');
|
||||
|
||||
@@ -222,7 +222,7 @@ class _FlutterPlatform extends PlatformPlugin {
|
||||
processObservatoryPort = detectedPort;
|
||||
},
|
||||
startTimeoutTimer: () {
|
||||
new Future<_InitialResult>.delayed(_kTestStartupTimeout, () => timeout.complete());
|
||||
new Future<_InitialResult>.delayed(_kTestStartupTimeout, timeout.complete);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -265,7 +265,7 @@ class _FlutterPlatform extends PlatformPlugin {
|
||||
final Completer<Null> harnessDone = new Completer<Null>();
|
||||
final StreamSubscription<dynamic> harnessToTest = controller.stream.listen(
|
||||
(dynamic event) { testSocket.add(JSON.encode(event)); },
|
||||
onDone: () { harnessDone.complete(); },
|
||||
onDone: harnessDone.complete,
|
||||
onError: (dynamic error, dynamic stack) {
|
||||
// If you reach here, it's unlikely we're going to be able to really handle this well.
|
||||
printError('test harness controller stream experienced an unexpected error\ntest: $testPath\nerror: $error');
|
||||
@@ -285,7 +285,7 @@ class _FlutterPlatform extends PlatformPlugin {
|
||||
assert(encodedEvent is String); // we shouldn't ever get binary messages
|
||||
controller.sink.add(JSON.decode(encodedEvent));
|
||||
},
|
||||
onDone: () { testDone.complete(); },
|
||||
onDone: testDone.complete,
|
||||
onError: (dynamic error, dynamic stack) {
|
||||
// If you reach here, it's unlikely we're going to be able to really handle this well.
|
||||
printError('test socket stream experienced an unexpected error\ntest: $testPath\nerror: $error');
|
||||
@@ -559,9 +559,7 @@ class _FlutterPlatformStreamSinkWrapper<S> implements StreamSink<S> {
|
||||
(List<dynamic> value) {
|
||||
_done.complete();
|
||||
},
|
||||
onError: (dynamic error, StackTrace stack) {
|
||||
_done.completeError(error, stack);
|
||||
},
|
||||
onError: _done.completeError,
|
||||
);
|
||||
return done;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,7 @@ const Duration kLongRequestTimeout = const Duration(minutes: 1);
|
||||
class VMService {
|
||||
VMService._(this._peer, this.httpAddress, this.wsAddress, this._requestTimeout) {
|
||||
_vm = new VM._empty(this);
|
||||
_peer.listen().catchError((dynamic e, StackTrace stackTrace) {
|
||||
_connectionError.completeError(e, stackTrace);
|
||||
});
|
||||
_peer.listen().catchError(_connectionError.completeError);
|
||||
|
||||
_peer.registerMethod('streamNotify', (rpc.Parameters event) {
|
||||
_handleStreamNotify(event.asMap);
|
||||
@@ -549,7 +547,7 @@ class VM extends ServiceObjectOwner {
|
||||
toRemove.add(id);
|
||||
}
|
||||
});
|
||||
toRemove.forEach((String id) => _isolateCache.remove(id));
|
||||
toRemove.forEach(_isolateCache.remove);
|
||||
_buildIsolateList();
|
||||
}
|
||||
|
||||
|
||||
@@ -157,13 +157,8 @@ class _RecordingStream {
|
||||
_recording.add(new _Response.fromString(element));
|
||||
_controller.add(element);
|
||||
},
|
||||
onError: (dynamic error, StackTrace stackTrace) {
|
||||
// We currently don't support recording of errors.
|
||||
_controller.addError(error, stackTrace);
|
||||
},
|
||||
onDone: () {
|
||||
_controller.close();
|
||||
},
|
||||
onError: _controller.addError, // We currently don't support recording of errors.
|
||||
onDone: _controller.close,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ void main() {
|
||||
final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>();
|
||||
daemon = new Daemon(
|
||||
commands.stream,
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
responses.add,
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
commands.add(<String, dynamic>{'id': 0, 'method': 'daemon.version'});
|
||||
@@ -69,7 +69,7 @@ void main() {
|
||||
final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>();
|
||||
daemon = new Daemon(
|
||||
commands.stream,
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
responses.add,
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
printError('daemon.logMessage test');
|
||||
@@ -95,7 +95,7 @@ void main() {
|
||||
final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>();
|
||||
daemon = new Daemon(
|
||||
commands.stream,
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
responses.add,
|
||||
notifyingLogger: notifyingLogger,
|
||||
logToStdout: true
|
||||
);
|
||||
@@ -115,7 +115,7 @@ void main() {
|
||||
final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>();
|
||||
daemon = new Daemon(
|
||||
commands.stream,
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
responses.add,
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
commands.add(<String, dynamic>{'id': 0, 'method': 'daemon.shutdown'});
|
||||
@@ -134,7 +134,7 @@ void main() {
|
||||
final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>();
|
||||
daemon = new Daemon(
|
||||
commands.stream,
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
responses.add,
|
||||
daemonCommand: command,
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
@@ -155,7 +155,7 @@ void main() {
|
||||
final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>();
|
||||
daemon = new Daemon(
|
||||
commands.stream,
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
responses.add,
|
||||
daemonCommand: command,
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
@@ -176,7 +176,7 @@ void main() {
|
||||
final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>();
|
||||
daemon = new Daemon(
|
||||
commands.stream,
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
responses.add,
|
||||
daemonCommand: command,
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
@@ -203,7 +203,7 @@ void main() {
|
||||
final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>();
|
||||
daemon = new Daemon(
|
||||
commands.stream,
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
responses.add,
|
||||
daemonCommand: command,
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
@@ -221,7 +221,7 @@ void main() {
|
||||
final StreamController<Map<String, dynamic>> responses = new StreamController<Map<String, dynamic>>();
|
||||
daemon = new Daemon(
|
||||
commands.stream,
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
responses.add,
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
commands.add(<String, dynamic>{'id': 0, 'method': 'device.getDevices'});
|
||||
|
||||
@@ -248,7 +248,7 @@ void main() {
|
||||
expect(device.name, 'mock-simulator');
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
Platform: () => macOsPlatform(),
|
||||
Platform: macOsPlatform,
|
||||
});
|
||||
|
||||
testUsingContext('uses existing Android device if and there are no simulators', () async {
|
||||
@@ -261,7 +261,7 @@ void main() {
|
||||
expect(device.name, 'mock-android-device');
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
Platform: () => macOsPlatform(),
|
||||
Platform: macOsPlatform,
|
||||
});
|
||||
|
||||
testUsingContext('launches emulator', () async {
|
||||
@@ -275,7 +275,7 @@ void main() {
|
||||
expect(device.name, 'new-simulator');
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
Platform: () => macOsPlatform(),
|
||||
Platform: macOsPlatform,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -288,7 +288,7 @@ void main() {
|
||||
expect(await findTargetDevice(), isNull);
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
Platform: () => platform(),
|
||||
Platform: platform,
|
||||
});
|
||||
|
||||
testUsingContext('uses existing Android device', () async {
|
||||
@@ -300,7 +300,7 @@ void main() {
|
||||
expect(device.name, 'mock-android-device');
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
Platform: () => platform(),
|
||||
Platform: platform,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user