本文讲述在正式项目工程中如何比较规范的构建fluro,由于也是初学,如果错误,望及时指正,请多见谅。
- 引入 fluro: ^1.6.1, 这是目前最新版本
- 需要再lib文件夹中新建文件夹router,并新建文件router_handler.dart。
3.router_handler.dart 中引入fluro及相关页面,我这里以详细页(details_page.dart DetailsPage)为例子

4.新建routers.dart,并正式编写路由, 注释掉的部分正常应该是个类似404或者not Found的页面。

5.还可以在新加个 application.dart文件,代码很少,目的就是静态化fluro,可以不用每次都调用一遍fluro;

6.之后在main.dart中引入

7.最后再其他页面中就可调用路由进入details_page这个页面了,调用方法如下:

当然,相应的页面还是需要引入application.dart文件的。
网友评论