Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example代码Flutter跳Native的传参问题 #5

Closed
louiskoo opened this issue Mar 7, 2019 · 4 comments
Closed

example代码Flutter跳Native的传参问题 #5

louiskoo opened this issue Mar 7, 2019 · 4 comments

Comments

@louiskoo
Copy link

louiskoo commented Mar 7, 2019

建议修改一下example代码中PageRouter的代码,因为实际上传过来的url是一个Uri,包含参数,示例代码的问题:
1.带参情况下,如果用equals作判断,无法判断准确,用startWith会否好一点?
2.可以把解析参数作为Bundle传入activity的方式补充一下,以方便初学者学习?

@Yacumima
Copy link
Collaborator

Yacumima commented Mar 7, 2019

嗯,好的,我们将会改进下sample

@Yacumima Yacumima closed this as completed Mar 7, 2019
@chaangliu
Copy link

我比较疑惑的是为什么不采取一个native页面上承载多个flutter页面的方案?导致页面参数传递需要组装到url中

@louiskoo
Copy link
Author

louiskoo commented Mar 7, 2019

我比较疑惑的是为什么不采取一个native页面上承载多个flutter页面的方案?导致页面参数传递需要组装到url中

不是很明白你的疑惑,
1.用FlutterFragmentActivity是可以承载多个flutter的,切换fragment就好了
2.不管是一个页面还是多个页面,来回切换都需要传参的吧

@chaangliu
Copy link

我比较疑惑的是为什么不采取一个native页面上承载多个flutter页面的方案?导致页面参数传递需要组装到url中

不是很明白你的疑惑,
1.用FlutterFragmentActivity是可以承载多个flutter的,切换fragment就好了
2.不管是一个页面还是多个页面,来回切换都需要传参的吧

  1. 可以不使用多个Activity/Fragment承载,而是使用一个Activity/Fragment承载所有flutter页面
  2. 如果是flutter页面之间传参,只需要把参数对象通过构造函数传递给需要的页面(widget)而无需序列化成字符串

不过我理解得可能不太对。我说的这个方案似乎比较适合某一整块业务大部分都是flutter页面的情形;如果是flutter和native频繁交替切换,或许flutter_boost更合适

noborder pushed a commit that referenced this issue Nov 14, 2019
noborder pushed a commit that referenced this issue Apr 24, 2020
0xZOne added a commit that referenced this issue Aug 23, 2022
08-19 17:11:17.042 22707 24893 I flutter : The following _CastError was thrown during a scheduler callback:
08-19 17:11:17.042 22707 24893 I flutter : type 'List<(String, Map<dynamic, dynamic>) => Future<dynamic>?>' is not a subtype of type
08-19 17:11:17.042 22707 24893 I flutter : 'List<(String, Map<dynamic, dynamic>?) => Future<dynamic>?>' in type cast
08-19 17:11:17.042 22707 24893 I flutter :
08-19 17:11:17.042 22707 24893 I flutter : When the exception was thrown, this was the stack:
08-19 17:11:17.042 22707 24893 I flutter : #0      FlutterBoostAppState.addEventListener (package:flutter_boost/src/flutter_boost_app.dart:653:11)
08-19 17:11:17.042 22707 24893 I flutter : #1      BoostChannel.addEventListener (package:flutter_boost/src/boost_channel.dart:34:23)
08-19 17:11:17.042 22707 24893 I flutter : #2      FlutterBoostAppState._addAppLifecycleStateEventListener (package:flutter_boost/src/flutter_boost_app.dart:119:10)
08-19 17:11:17.042 22707 24893 I flutter : #3      FlutterBoostAppState.initState.<anonymous closure> (package:flutter_boost/src/flutter_boost_app.dart:108:7)
08-19 17:11:17.042 22707 24893 I flutter : #4      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
08-19 17:11:17.042 22707 24893 I flutter : #5      SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1088:9)
08-19 17:11:17.042 22707 24893 I flutter : #6      PerformanceFlutterBinding.handleDrawFrame (package:high_available/src/api/performance_flutter_binding.dart:29:11)
08-19 17:11:17.042 22707 24893 I flutter : #7      SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:863:7)
08-19 17:11:17.042 22707 24893 I flutter : (elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
@LoveJello LoveJello mentioned this issue Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants