Uncontroversial and backwards compatible 2.0 SDK fixes (#13723)
Small code changes as part of moving the framework SDK forward to a 2.0 dev version.
This commit is contained in:
@@ -149,17 +149,15 @@ class GalleryAppState extends State<GalleryApp> {
|
||||
);
|
||||
}
|
||||
|
||||
final Map<String, WidgetBuilder> _kRoutes =
|
||||
new Map<String, WidgetBuilder>.fromIterable(
|
||||
final Map<String, WidgetBuilder> _kRoutes = <String, WidgetBuilder>{};
|
||||
for (GalleryItem item in kAllGalleryItems) {
|
||||
// For a different example of how to set up an application routing table
|
||||
// using named routes, consider the example in the Navigator class documentation:
|
||||
// https://docs.flutter.io/flutter/widgets/Navigator-class.html
|
||||
kAllGalleryItems,
|
||||
key: (GalleryItem item) => item.routeName,
|
||||
value: (GalleryItem item) {
|
||||
return (BuildContext context) => _applyScaleFactor(item.buildRoute(context));
|
||||
},
|
||||
);
|
||||
_kRoutes[item.routeName] = (BuildContext context) {
|
||||
return _applyScaleFactor(item.buildRoute(context));
|
||||
};
|
||||
}
|
||||
|
||||
return new MaterialApp(
|
||||
title: 'Flutter Gallery',
|
||||
|
||||
@@ -40,7 +40,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
|
||||
eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError);
|
||||
}
|
||||
|
||||
void _onEvent(String event) {
|
||||
void _onEvent(Object event) {
|
||||
setState(() {
|
||||
_chargingStatus =
|
||||
"Battery status: ${event == 'charging' ? '' : 'dis'}charging.";
|
||||
|
||||
@@ -40,7 +40,7 @@ class _PlatformChannelState extends State<PlatformChannel> {
|
||||
eventChannel.receiveBroadcastStream().listen(_onEvent, onError: _onError);
|
||||
}
|
||||
|
||||
void _onEvent(String event) {
|
||||
void _onEvent(Object event) {
|
||||
setState(() {
|
||||
_chargingStatus =
|
||||
"Battery status: ${event == 'charging' ? '' : 'dis'}charging.";
|
||||
|
||||
@@ -19,7 +19,7 @@ class StockStrings {
|
||||
|
||||
static Future<StockStrings> load(Locale locale) {
|
||||
return initializeMessages(locale.toString())
|
||||
.then((Null _) {
|
||||
.then((Object _) {
|
||||
return new StockStrings(locale);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user