最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

dart - How can I generate an 403 Forbidded error using go_router in flutter without redirecting to forbidden page itself? - Stac

programmeradmin2浏览0评论

I need to implement 403 Forbidden page in web flutter application without redirecting to some /forbidden path but leaving on the page which is forbidden. It it possible?

I need to implement 403 Forbidden page in web flutter application without redirecting to some /forbidden path but leaving on the page which is forbidden. It it possible?

Share Improve this question asked Mar 31 at 9:30 BambinoUABambinoUA 7,1905 gold badges41 silver badges61 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

On the root of the application add a stream listener.

From the redirect function of go router add a future callback for the forbidden page based on business logic.

In the future callback add an event to the stream sink. Add a delay before adding the event to the sink.

The listener can be used to display the Forbidden Dialog/ Widget.

Not the best approch. but will work. Redirecting to forbidden still is the best way

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论