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

[platform_channels] Migrate to sound null safety (#803)

This commit is contained in:
Ayush Bherwani
2021-06-08 04:00:12 +05:30
committed by GitHub
parent c8112c88ac
commit 865c545f3d
15 changed files with 50 additions and 46 deletions

View File

@@ -26,21 +26,21 @@ class EventChannelDemo extends StatelessWidget {
stream: Accelerometer.readings,
builder: (context, snapshot) {
if (snapshot.hasError) {
return Text((snapshot.error as PlatformException).message);
return Text((snapshot.error as PlatformException).message!);
} else if (snapshot.hasData) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'x axis: ' + snapshot.data.x.toStringAsFixed(3),
'x axis: ' + snapshot.data!.x.toStringAsFixed(3),
style: textStyle,
),
Text(
'y axis: ' + snapshot.data.y.toStringAsFixed(3),
'y axis: ' + snapshot.data!.y.toStringAsFixed(3),
style: textStyle,
),
Text(
'z axis: ' + snapshot.data.z.toStringAsFixed(3),
'z axis: ' + snapshot.data!.z.toStringAsFixed(3),
style: textStyle,
)
],