1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 22:09:06 +00:00

[platform_channels] adds EventChannel implementation for iOS (#595)

This commit is contained in:
Ayush Bherwani
2020-12-02 11:58:50 +05:30
committed by GitHub
parent 1edac4ca35
commit a29be3d45e
6 changed files with 66 additions and 7 deletions

View File

@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:platform_channels/src/accelerometer_event_channel.dart';
/// Demonstrates how to use [EventChannel] to listen continuous values
@@ -25,7 +26,7 @@ class EventChannelDemo extends StatelessWidget {
stream: Accelerometer.readings,
builder: (context, snapshot) {
if (snapshot.hasError) {
return Text(snapshot.error.toString());
return Text((snapshot.error as PlatformException).message);
} else if (snapshot.hasData) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,