apply partially the upcoming unnecessary_lambdas (#8810)
This commit is contained in:
parent
f9ad230f15
commit
2166ea5b7f
@ -430,9 +430,7 @@ Future<Null> runAndCaptureAsyncStacks(Future<Null> callback()) {
|
||||
Chain.capture(() async {
|
||||
await callback();
|
||||
completer.complete();
|
||||
}, onError: (dynamic error, Chain chain) async {
|
||||
completer.completeError(error, chain);
|
||||
});
|
||||
}, onError: completer.completeError);
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ class _AnimationDemoHomeState extends State<AnimationDemoHome> {
|
||||
backgroundColor: _kAppBackgroundColor,
|
||||
body: new Builder(
|
||||
// Insert an element so that _buildBody can find the PrimaryScrollController.
|
||||
builder: (BuildContext context) => _buildBody(context),
|
||||
builder: _buildBody,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -108,9 +108,7 @@ class ShrinePageState extends State<ShrinePage> {
|
||||
new IconButton(
|
||||
icon: new Icon(Icons.shopping_cart),
|
||||
tooltip: 'Shopping cart',
|
||||
onPressed: () {
|
||||
_showShoppingCart();
|
||||
}
|
||||
onPressed: _showShoppingCart
|
||||
),
|
||||
new PopupMenuButton<ShrineAction>(
|
||||
itemBuilder: (BuildContext context) => <PopupMenuItem<ShrineAction>>[
|
||||
|
@ -183,9 +183,7 @@ class CalculationManager {
|
||||
onProgressListener: (double completed, double total) {
|
||||
sender.send(<double>[ completed, total ]);
|
||||
},
|
||||
onResultListener: (String result) {
|
||||
sender.send(result);
|
||||
},
|
||||
onResultListener: sender.send,
|
||||
data: message.data
|
||||
);
|
||||
calculator.run();
|
||||
|
@ -24,7 +24,7 @@ class _NotImplementedDialog extends StatelessWidget {
|
||||
content: new Text('This feature has not yet been implemented.'),
|
||||
actions: <Widget>[
|
||||
new FlatButton(
|
||||
onPressed: () { debugDumpApp(); },
|
||||
onPressed: debugDumpApp,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Icon(
|
||||
|
@ -105,7 +105,7 @@ class StockSettingsState extends State<StockSettings> {
|
||||
final List<Widget> rows = <Widget>[
|
||||
new DrawerItem(
|
||||
icon: new Icon(Icons.thumb_up),
|
||||
onPressed: () => _confirmOptimismChange(),
|
||||
onPressed: _confirmOptimismChange,
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Expanded(child: new Text('Everything is awesome')),
|
||||
|
@ -207,7 +207,7 @@ class DoubleTapGestureRecognizer extends GestureRecognizer {
|
||||
}
|
||||
|
||||
void _startDoubleTapTimer() {
|
||||
_doubleTapTimer ??= new Timer(kDoubleTapTimeout, () => _reset());
|
||||
_doubleTapTimer ??= new Timer(kDoubleTapTimeout, _reset);
|
||||
}
|
||||
|
||||
void _stopDoubleTapTimer() {
|
||||
|
@ -221,9 +221,7 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
|
||||
// animations such that their resulting flex values will add up to the desired
|
||||
// value.
|
||||
void _computeWeight() {
|
||||
final Iterable<Animation<double>> animating = _animations.where(
|
||||
(Animation<double> animation) => _isAnimating(animation)
|
||||
);
|
||||
final Iterable<Animation<double>> animating = _animations.where(_isAnimating);
|
||||
|
||||
if (animating.isNotEmpty) {
|
||||
final double sum = animating.fold(0.0, (double sum, Animation<double> animation) {
|
||||
@ -246,11 +244,8 @@ class _BottomNavigationBarState extends State<BottomNavigationBar> with TickerPr
|
||||
|
||||
double _xOffset(int index) {
|
||||
double weightSum(Iterable<Animation<double>> animations) {
|
||||
return animations.map(
|
||||
// We're adding flex values instead of animation values to have correct
|
||||
// ratios.
|
||||
(Animation<double> animation) => _flex(animation)
|
||||
).fold(0.0, (double sum, double value) => sum + value);
|
||||
// We're adding flex values instead of animation values to have correct ratios.
|
||||
return animations.map(_flex).fold(0.0, (double sum, double value) => sum + value);
|
||||
}
|
||||
|
||||
final double allWeights = weightSum(_animations);
|
||||
|
@ -127,9 +127,7 @@ class _InputFieldState extends State<InputField> {
|
||||
new GestureDetector(
|
||||
key: focusKey == _focusKey ? _focusKey : null,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
requestKeyboard();
|
||||
},
|
||||
onTap: requestKeyboard,
|
||||
// Since the focusKey may have been created here, defer building the
|
||||
// EditableText until the focusKey's context has been set. This is
|
||||
// necessary because the EditableText will check the focus, like
|
||||
|
@ -679,7 +679,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
|
||||
_currentBottomSheet = new PersistentBottomSheetController<T>._(
|
||||
bottomSheet,
|
||||
completer,
|
||||
() => entry.remove(),
|
||||
entry.remove,
|
||||
(VoidCallback fn) { bottomSheetKey.currentState?.setState(fn); }
|
||||
);
|
||||
});
|
||||
|
@ -13,8 +13,6 @@ import 'dart:ui' as ui show Image, decodeImageFromList;
|
||||
/// resolves to [null].
|
||||
Future<ui.Image> decodeImageFromList(Uint8List list) {
|
||||
final Completer<ui.Image> completer = new Completer<ui.Image>();
|
||||
ui.decodeImageFromList(list, (ui.Image image) {
|
||||
completer.complete(image);
|
||||
});
|
||||
ui.decodeImageFromList(list, completer.complete);
|
||||
return completer.future;
|
||||
}
|
||||
|
@ -52,9 +52,7 @@ void main() {
|
||||
final List<double> valueLog = <double>[];
|
||||
final List<AnimationStatus> log = <AnimationStatus>[];
|
||||
controller
|
||||
..addStatusListener((AnimationStatus status) {
|
||||
log.add(status);
|
||||
})
|
||||
..addStatusListener(log.add)
|
||||
..addListener(() {
|
||||
valueLog.add(controller.value);
|
||||
});
|
||||
@ -115,9 +113,7 @@ void main() {
|
||||
final List<double> valueLog = <double>[];
|
||||
final List<AnimationStatus> statusLog = <AnimationStatus>[];
|
||||
controller
|
||||
..addStatusListener((AnimationStatus status) {
|
||||
statusLog.add(status);
|
||||
})
|
||||
..addStatusListener(statusLog.add)
|
||||
..addListener(() {
|
||||
valueLog.add(controller.value);
|
||||
});
|
||||
@ -143,9 +139,7 @@ void main() {
|
||||
final List<double> valueLog = <double>[];
|
||||
final List<AnimationStatus> statusLog = <AnimationStatus>[];
|
||||
controller
|
||||
..addStatusListener((AnimationStatus status) {
|
||||
statusLog.add(status);
|
||||
})
|
||||
..addStatusListener(statusLog.add)
|
||||
..addListener(() {
|
||||
valueLog.add(controller.value);
|
||||
});
|
||||
|
@ -58,9 +58,7 @@ class TestServiceExtensionsBinding extends BindingBase
|
||||
|
||||
Future<Null> flushMicrotasks() {
|
||||
final Completer<Null> completer = new Completer<Null>();
|
||||
new Timer(const Duration(), () {
|
||||
completer.complete();
|
||||
});
|
||||
new Timer(const Duration(), completer.complete);
|
||||
return completer.future;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ void main() {
|
||||
);
|
||||
|
||||
final List<PointerEvent> events = <PointerEvent>[];
|
||||
_binding.callback = (PointerEvent event) => events.add(event);
|
||||
_binding.callback = events.add;
|
||||
|
||||
ui.window.onPointerDataPacket(packet);
|
||||
expect(events.length, 2);
|
||||
@ -59,7 +59,7 @@ void main() {
|
||||
);
|
||||
|
||||
final List<PointerEvent> events = <PointerEvent>[];
|
||||
_binding.callback = (PointerEvent event) => events.add(event);
|
||||
_binding.callback = events.add;
|
||||
|
||||
ui.window.onPointerDataPacket(packet);
|
||||
expect(events.length, 3);
|
||||
@ -85,7 +85,7 @@ void main() {
|
||||
);
|
||||
|
||||
final List<PointerEvent> events = <PointerEvent>[];
|
||||
_binding.callback = (PointerEvent event) => events.add(event);
|
||||
_binding.callback = events.add;
|
||||
|
||||
ui.window.onPointerDataPacket(packet);
|
||||
expect(events.length, 3);
|
||||
@ -104,7 +104,7 @@ void main() {
|
||||
);
|
||||
|
||||
final List<PointerEvent> events = <PointerEvent>[];
|
||||
_binding.callback = (PointerEvent event) => events.add(event);
|
||||
_binding.callback = events.add;
|
||||
|
||||
ui.window.onPointerDataPacket(packet);
|
||||
expect(events.length, 2);
|
||||
|
@ -16,9 +16,7 @@ void main() {
|
||||
key: key,
|
||||
value: 1,
|
||||
groupValue: 2,
|
||||
onChanged: (int value) {
|
||||
log.add(value);
|
||||
},
|
||||
onChanged: log.add,
|
||||
),
|
||||
),
|
||||
));
|
||||
@ -34,9 +32,7 @@ void main() {
|
||||
key: key,
|
||||
value: 1,
|
||||
groupValue: 1,
|
||||
onChanged: (int value) {
|
||||
log.add(value);
|
||||
},
|
||||
onChanged: log.add,
|
||||
activeColor: Colors.green[500],
|
||||
),
|
||||
),
|
||||
|
@ -25,9 +25,7 @@ void main() {
|
||||
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
|
||||
return new Container(height: 100.0, child: new Text('Target'));
|
||||
},
|
||||
onAccept: (int data) {
|
||||
accepted.add(data);
|
||||
}
|
||||
onAccept: accepted.add
|
||||
),
|
||||
]
|
||||
)
|
||||
@ -539,9 +537,7 @@ void main() {
|
||||
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
|
||||
return new Container(height: 100.0, child: new Text('Target'));
|
||||
},
|
||||
onAccept: (int data) {
|
||||
accepted.add(data);
|
||||
}
|
||||
onAccept: accepted.add
|
||||
),
|
||||
]
|
||||
)
|
||||
@ -731,9 +727,7 @@ void main() {
|
||||
)
|
||||
);
|
||||
},
|
||||
onAccept: (int data) {
|
||||
acceptedInts.add(data);
|
||||
}
|
||||
onAccept: acceptedInts.add
|
||||
),
|
||||
new DragTarget<double>(
|
||||
builder: (BuildContext context, List<double> data, List<dynamic> rejects) {
|
||||
@ -744,9 +738,7 @@ void main() {
|
||||
)
|
||||
);
|
||||
},
|
||||
onAccept: (double data) {
|
||||
acceptedDoubles.add(data);
|
||||
}
|
||||
onAccept: acceptedDoubles.add
|
||||
),
|
||||
]
|
||||
)
|
||||
@ -842,9 +834,7 @@ void main() {
|
||||
child: new Text('Target1')
|
||||
)
|
||||
);
|
||||
}, onAccept: (DragTargetData data) {
|
||||
acceptedDragTargetDatas.add(data);
|
||||
}
|
||||
}, onAccept: acceptedDragTargetDatas.add
|
||||
),
|
||||
new DragTarget<ExtendedDragTargetData>(
|
||||
builder: (BuildContext context, List<ExtendedDragTargetData> data, List<dynamic> rejects) {
|
||||
@ -855,9 +845,7 @@ void main() {
|
||||
)
|
||||
);
|
||||
},
|
||||
onAccept: (ExtendedDragTargetData data) {
|
||||
acceptedExtendedDragTargetDatas.add(data);
|
||||
}
|
||||
onAccept: acceptedExtendedDragTargetDatas.add
|
||||
),
|
||||
]
|
||||
)
|
||||
@ -901,9 +889,7 @@ void main() {
|
||||
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
|
||||
return new Container(height: 100.0, child: new Text('Target'));
|
||||
},
|
||||
onAccept: (int data) {
|
||||
accepted.add(data);
|
||||
}
|
||||
onAccept: accepted.add
|
||||
),
|
||||
]
|
||||
)
|
||||
@ -1140,9 +1126,7 @@ void main() {
|
||||
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
|
||||
return new Container(height: 100.0, child: new Text('Target'));
|
||||
},
|
||||
onAccept: (int data) {
|
||||
accepted.add(data);
|
||||
}
|
||||
onAccept: accepted.add
|
||||
),
|
||||
]
|
||||
)
|
||||
@ -1169,9 +1153,7 @@ void main() {
|
||||
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
|
||||
return new Container(height: 100.0, child: new Text('Target'));
|
||||
},
|
||||
onAccept: (int data) {
|
||||
accepted.add(data);
|
||||
}
|
||||
onAccept: accepted.add
|
||||
),
|
||||
]
|
||||
)
|
||||
@ -1258,9 +1240,7 @@ Future<Null> _testChildAnchorFeedbackPosition({WidgetTester tester, double top:
|
||||
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
|
||||
return new Container(height: 100.0, child: new Text('Target'));
|
||||
},
|
||||
onAccept: (int data) {
|
||||
accepted.add(data);
|
||||
}
|
||||
onAccept: accepted.add
|
||||
),
|
||||
]
|
||||
)
|
||||
|
@ -223,9 +223,7 @@ void main() {
|
||||
testWidgets('Page changes at halfway point', (WidgetTester tester) async {
|
||||
final List<int> log = <int>[];
|
||||
await tester.pumpWidget(new PageView(
|
||||
onPageChanged: (int page) {
|
||||
log.add(page);
|
||||
},
|
||||
onPageChanged: log.add,
|
||||
children: kStates.map<Widget>((String state) => new Text(state)).toList(),
|
||||
));
|
||||
|
||||
|
@ -28,9 +28,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(new RawKeyboardListener(
|
||||
focused: true,
|
||||
onKey: (RawKeyEvent event) {
|
||||
events.add(event);
|
||||
},
|
||||
onKey: events.add,
|
||||
child: new Container(),
|
||||
));
|
||||
|
||||
@ -59,9 +57,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(new RawKeyboardListener(
|
||||
focused: true,
|
||||
onKey: (RawKeyEvent event) {
|
||||
events.add(event);
|
||||
},
|
||||
onKey: events.add,
|
||||
child: new Container(),
|
||||
));
|
||||
|
||||
|
@ -160,7 +160,7 @@ class TimelineSummary {
|
||||
|
||||
return durations
|
||||
.map<double>((Duration duration) => duration.inMilliseconds.toDouble())
|
||||
.reduce((double a, double b) => math.max(a, b));
|
||||
.reduce(math.max);
|
||||
}
|
||||
|
||||
List<TimedEvent> _extractGpuRasterizerDrawEvents() => _extractBeginEndEvents('GPURasterizer::Draw');
|
||||
|
@ -889,7 +889,7 @@ class _LiveTestRenderView extends RenderView {
|
||||
.keys
|
||||
.where((int pointer) => _pointers[pointer].decay == 0)
|
||||
.toList()
|
||||
.forEach((int pointer) { _pointers.remove(pointer); });
|
||||
.forEach(_pointers.remove);
|
||||
if (dirty)
|
||||
scheduleMicrotask(markNeedsPaint);
|
||||
}
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user