1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 23:08:59 +00:00
This commit is contained in:
Brett Morgan
2022-05-11 12:48:11 -07:00
committed by GitHub
parent fb00d0a102
commit ccd68f34e2
242 changed files with 1719 additions and 1430 deletions

View File

@@ -20,7 +20,7 @@ void main() {
// and add the incoming message to the StreamController used by the EventChannel
// after decoding the message with codec used by the EventChannel.
void emitValues(ByteData? event) {
ServicesBinding.instance?.defaultBinaryMessenger.handlePlatformMessage(
ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage(
'eventChannelDemo',
event,
(reply) {},
@@ -29,7 +29,7 @@ void main() {
// Register a mock for EventChannel. EventChannel under the hood uses
// MethodChannel to listen and cancel the created stream.
ServicesBinding.instance?.defaultBinaryMessenger
ServicesBinding.instance.defaultBinaryMessenger
.setMockMessageHandler('eventChannelDemo', (message) async {
// Decode the message into MethodCallHandler.
final methodCall = standardMethod.decodeMethodCall(message);
@@ -57,15 +57,15 @@ void main() {
// Check the values of axis. The value is rounded to 3 decimal places.
expect(
find.text('x axis: ' + sensorValues[0].toStringAsFixed(3)),
find.text('x axis: ${sensorValues[0].toStringAsFixed(3)}'),
findsOneWidget,
);
expect(
find.text('y axis: ' + sensorValues[1].toStringAsFixed(3)),
find.text('y axis: ${sensorValues[1].toStringAsFixed(3)}'),
findsOneWidget,
);
expect(
find.text('z axis: ' + sensorValues[2].toStringAsFixed(3)),
find.text('z axis: ${sensorValues[2].toStringAsFixed(3)}'),
findsOneWidget,
);
});