mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 23:08:59 +00:00
Beta (#1234)
This commit is contained in:
@@ -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,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user