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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user