如何在颤振中在路由页面之间发送数据?
How to send data between route pages in flutter?
所以我有两个页面,我用它导航到另一个页面
Navigator.of(context).pushNamed('page-2');
如何将数据对象从第 1 页传递到第 2 页?
正如@Linus Juhlin 提到的,这个话题仍在讨论中,实际上它上周在 flutter google group
中再次出现
你实际上可以使用 the onGenerateRoute
property from MaterialApp
to build the Route
s yourself as shown in the stocks demo app. This gets a bit tricky because you'll have to pass in a string representation of the data you need to pass to the next page when pushing the route。
您还可以使用名为 Fluro 的库,它隐藏了一些样板代码,您只需定义处理函数来处理每个路由。
所以我有两个页面,我用它导航到另一个页面
Navigator.of(context).pushNamed('page-2');
如何将数据对象从第 1 页传递到第 2 页?
正如@Linus Juhlin 提到的,这个话题仍在讨论中,实际上它上周在 flutter google group
中再次出现你实际上可以使用 the onGenerateRoute
property from MaterialApp
to build the Route
s yourself as shown in the stocks demo app. This gets a bit tricky because you'll have to pass in a string representation of the data you need to pass to the next page when pushing the route。
您还可以使用名为 Fluro 的库,它隐藏了一些样板代码,您只需定义处理函数来处理每个路由。