在通过 go_router 在 Flutter web 中导航时,我们能否隐藏查询参数?

huangapple go评论65阅读模式
英文:

Are we able to hide the query parameter in flutter web while navigating through go_router?

问题

"假设我需要隐藏通过go_router的查询参数发送的一些重要参数,如 -

GoRouter.of(context).pushNamed(route, queryParameters: { 'id': 'hhhhhh', 'key': 'yyyyy' });

我不想让用户看到Id,Flutter中是否有可能实现这一点?

我尝试了dart:convert中存在的Uri.encodeQueryParameters()函数,但没有成功。"

英文:

Assume that I have to hide a few essential parameters which are sent through go_router's query params like - "

GoRouter.of(context).pushNamed(route, queryParameters: {
'id': 'hhhhhh',
'key': 'yyyyy'
});

I don't want to let the user see the Id, is that possible in Flutter?

I tried the Uri.encodeQueryParameters() function which is present in dart:convert but it didn't work.

答案1

得分: 0

实际上,你无法隐藏这一点,但你可以对其进行加密并在其他页面上进行解密,因此查询参数应该是类似 data = "加密数据",然后你在其他页面上解密它,用户只能看到加密的数据。

英文:

Actually, You can't hide this but You can encrypt this and decrypt it from the other page so the query params should be something like data = "encrypted data" and then you decrypt it from the other page and for the user will see only the encrypted data

huangapple
  • 本文由 发表于 2023年5月15日 00:10:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76248474.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定