简体   繁体   English

Flutter - 如何在 GetX 中广播?

[英]Flutter - How to broadcast in GetX?

I have a requirement: I have A, B, C, D, E.... multi pages in App.我有一个要求:我在 App 中有 A、B、C、D、E.... 多页。 And now When I click a button in Page E, change the keyword, All page's controller will get this notification and use this changed keyword to query the web server then update page's UI.现在,当我单击页面 E 中的按钮,更改关键字时,所有页面的控制器都会收到此通知并使用此更改的关键字来查询 Web 服务器,然后更新页面的 UI。

I know 'EventBus' can achieve this goal.我知道“EventBus”可以实现这个目标。 Do you know how to do in GetX.你知道如何在 GetX 中进行操作吗?

You can use Obx() widget.您可以使用 Obx() 小部件。 Then you can use FutureBuilder inside it for webserver requests.然后您可以在其中使用 FutureBuilder 来处理网络服务器请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM