Commit 6d98bca6 authored by justin's avatar justin Committed by GitHub

Merge pull request #694 from AlexVincent525/master

Fix type cast error with `invokeMethod` method.
parents db7ca34a fbd1446f
...@@ -55,7 +55,7 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget> { ...@@ -55,7 +55,7 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget> {
print('open natve page!'); print('open natve page!');
FlutterBoost.singleton FlutterBoost.singleton
.open('native') .open('native')
.then((Map<String, dynamic> value) { .then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve native route result $value'); 'call me when page is finished. did recieve native route result $value');
}); });
...@@ -67,7 +67,7 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget> { ...@@ -67,7 +67,7 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget> {
print('open FF page!'); print('open FF page!');
FlutterBoost.singleton FlutterBoost.singleton
.open('firstFirst') .open('firstFirst')
.then((Map<String, dynamic> value) { .then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve FF route result $value'); 'call me when page is finished. did recieve FF route result $value');
}); });
...@@ -79,7 +79,7 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget> { ...@@ -79,7 +79,7 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget> {
print('open second page!'); print('open second page!');
FlutterBoost.singleton FlutterBoost.singleton
.open('second') .open('second')
.then((Map<String, dynamic> value) { .then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve second route result $value'); 'call me when page is finished. did recieve second route result $value');
}); });
...@@ -92,7 +92,7 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget> { ...@@ -92,7 +92,7 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget> {
FlutterBoost.singleton.open('secondStateful', FlutterBoost.singleton.open('secondStateful',
urlParams: <String, dynamic>{ urlParams: <String, dynamic>{
'present': true 'present': true
}).then((Map<String, dynamic> value) { }).then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve second stateful route result $value'); 'call me when page is finished. did recieve second stateful route result $value');
}); });
...@@ -105,7 +105,7 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget> { ...@@ -105,7 +105,7 @@ class _FirstRouteWidgetState extends State<FirstRouteWidget> {
FlutterBoost.singleton.open('second', FlutterBoost.singleton.open('second',
urlParams: <String, dynamic>{ urlParams: <String, dynamic>{
'present': true 'present': true
}).then((Map<String, dynamic> value) { }).then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve second route result $value'); 'call me when page is finished. did recieve second route result $value');
}); });
...@@ -167,7 +167,7 @@ class _FirstFirstRouteWidgetState extends State<FirstFirstRouteWidget> { ...@@ -167,7 +167,7 @@ class _FirstFirstRouteWidgetState extends State<FirstFirstRouteWidget> {
print('open first page again!'); print('open first page again!');
FlutterBoost.singleton FlutterBoost.singleton
.open('first') .open('first')
.then((Map<String, dynamic> value) { .then((Map<dynamic, dynamic> value) {
print('did recieve first route result'); print('did recieve first route result');
print('did recieve first route result $value'); print('did recieve first route result $value');
}); });
...@@ -195,7 +195,7 @@ class _EmbeddedFirstRouteWidgetState extends State<EmbeddedFirstRouteWidget> { ...@@ -195,7 +195,7 @@ class _EmbeddedFirstRouteWidgetState extends State<EmbeddedFirstRouteWidget> {
print('open second page!'); print('open second page!');
FlutterBoost.singleton FlutterBoost.singleton
.open('second') .open('second')
.then((Map<String, dynamic> value) { .then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve second route result $value'); 'call me when page is finished. did recieve second route result $value');
}); });
...@@ -296,7 +296,7 @@ class PlatformRouteWidget extends StatelessWidget { ...@@ -296,7 +296,7 @@ class PlatformRouteWidget extends StatelessWidget {
print('open second page!'); print('open second page!');
FlutterBoost.singleton FlutterBoost.singleton
.open('second') .open('second')
.then((Map<String, dynamic> value) { .then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve second route result $value'); 'call me when page is finished. did recieve second route result $value');
}); });
......
...@@ -15,7 +15,7 @@ class FirstRouteWidget extends StatelessWidget { ...@@ -15,7 +15,7 @@ class FirstRouteWidget extends StatelessWidget {
print('open second page!'); print('open second page!');
FlutterBoost.singleton FlutterBoost.singleton
.open('second') .open('second')
.then((Map<String, dynamic> value) { .then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve second route result $value'); 'call me when page is finished. did recieve second route result $value');
}); });
......
...@@ -69,8 +69,9 @@ class FlutterBoost { ...@@ -69,8 +69,9 @@ class FlutterBoost {
static void onPageStart() { static void onPageStart() {
WidgetsBinding.instance.addPostFrameCallback((Duration _) { WidgetsBinding.instance.addPostFrameCallback((Duration _) {
singleton.channel singleton.channel
.invokeMethod<Map<String, dynamic>>('pageOnStart') .invokeMethod<Map<dynamic, dynamic>>('pageOnStart')
.then((Map<String, dynamic> pageInfo) { .then((Map<dynamic, dynamic> _pageInfo) {
final Map<String, dynamic> pageInfo = _pageInfo?.cast<String, dynamic>();
if (pageInfo?.isEmpty ?? true) { if (pageInfo?.isEmpty ?? true) {
return; return;
} }
...@@ -137,7 +138,7 @@ class FlutterBoost { ...@@ -137,7 +138,7 @@ class FlutterBoost {
ContainerCoordinator.singleton.registerPageBuilders(builders); ContainerCoordinator.singleton.registerPageBuilders(builders);
} }
Future<Map<String, dynamic>> open( Future<Map<dynamic, dynamic>> open(
String url, { String url, {
Map<String, dynamic> urlParams, Map<String, dynamic> urlParams,
Map<String, dynamic> exts, Map<String, dynamic> exts,
...@@ -146,7 +147,7 @@ class FlutterBoost { ...@@ -146,7 +147,7 @@ class FlutterBoost {
properties['url'] = url; properties['url'] = url;
properties['urlParams'] = urlParams; properties['urlParams'] = urlParams;
properties['exts'] = exts; properties['exts'] = exts;
return channel.invokeMethod<Map<String, dynamic>>('openPage', properties); return channel.invokeMethod<Map<dynamic, dynamic>>('openPage', properties);
} }
Future<bool> close( Future<bool> close(
......
...@@ -24,7 +24,7 @@ class FirstRouteWidget extends StatelessWidget { ...@@ -24,7 +24,7 @@ class FirstRouteWidget extends StatelessWidget {
print('open second page!'); print('open second page!');
FlutterBoost.singleton FlutterBoost.singleton
.open('second') .open('second')
.then((Map<String, dynamic> value) { .then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve second route result $value'); 'call me when page is finished. did recieve second route result $value');
}); });
...@@ -54,7 +54,7 @@ class SecondRouteWidget extends StatelessWidget { ...@@ -54,7 +54,7 @@ class SecondRouteWidget extends StatelessWidget {
print('open second page!'); print('open second page!');
FlutterBoost.singleton FlutterBoost.singleton
.open('second') .open('second')
.then((Map<String, dynamic> value) { .then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve second route result $value'); 'call me when page is finished. did recieve second route result $value');
}); });
......
...@@ -19,7 +19,7 @@ class FirstRouteWidget extends StatelessWidget { ...@@ -19,7 +19,7 @@ class FirstRouteWidget extends StatelessWidget {
print('open second page!'); print('open second page!');
FlutterBoost.singleton FlutterBoost.singleton
.open('second') .open('second')
.then((Map<String, dynamic> value) { .then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve second route result $value'); 'call me when page is finished. did recieve second route result $value');
}); });
...@@ -32,7 +32,7 @@ class FirstRouteWidget extends StatelessWidget { ...@@ -32,7 +32,7 @@ class FirstRouteWidget extends StatelessWidget {
FlutterBoost.singleton.open('second', FlutterBoost.singleton.open('second',
urlParams: <String, dynamic>{ urlParams: <String, dynamic>{
'present': true 'present': true
}).then((Map<String, dynamic> value) { }).then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve second route result $value'); 'call me when page is finished. did recieve second route result $value');
}); });
...@@ -56,7 +56,7 @@ class EmbededFirstRouteWidget extends StatelessWidget { ...@@ -56,7 +56,7 @@ class EmbededFirstRouteWidget extends StatelessWidget {
print('open second page!'); print('open second page!');
FlutterBoost.singleton FlutterBoost.singleton
.open('second') .open('second')
.then((Map<String, dynamic> value) { .then((Map<dynamic, dynamic> value) {
print( print(
'call me when page is finished. did recieve second route result $value'); 'call me when page is finished. did recieve second route result $value');
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment