![]() |
任性的高山 · 【已解决】RuntimeError: ...· 2 周前 · |
![]() |
高大的毛衣 · 个人算力终端:重构开发者生产力的“下一站” ...· 1 周前 · |
![]() |
从容的炒面 · nexus Maven仓库-阿里云· 1 周前 · |
![]() |
爱搭讪的麻辣香锅 · Oracle 代码异常查询(七)-阿里云开发者社区· 1 周前 · |
![]() |
风流倜傥的凳子 · 如何在UITextView中禁用换行和只启用 ...· 1 周前 · |
![]() |
纯真的毛衣 · ThreadPoolExecutor原理浅析 ...· 1 年前 · |
![]() |
想出国的苦瓜 · @RabbitListener和@Rabbi ...· 2 年前 · |
![]() |
拉风的大熊猫 · python---批量修改图片名,以数字递增 ...· 2 年前 · |
![]() |
爱喝酒的牛肉面 · 自动化 - 抖音 x ...· 2 年前 · |
我正在使用Flutter notification_permissions包。
我可以通过调用以下命令异步检索设备通知权限状态:
PermissionStatus p = await NotificationPermissions.getNotificationPermissionStatus()
然而,我不想只做一次。我想以流的形式监听通知状态,这样当它发生变化时,我就可以在UI中做出相应的响应。
我尝试了以下几种方法:
NotificationPermissions.getNotificationPermissionStatus().asStream().listen((PermissionStatus s) {
print('Notification permissions: $s');
}
但是,当我更改设备上的通知设置时,此流不会发出事件。
我如何才能做到这一点?
发布于 2019-10-04 06:07:52
通过创建一个监听AppLifecycleState的有状态小部件,我已经实现了我想要的功能。然后,每当应用程序恢复检查通知设置的状态时,我都会调用我的异步函数。
更多信息请点击此处: Flutter: Update Widgets On Resume?
https://stackoverflow.com/questions/58226829
复制相似问题
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2023 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号: 粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
![]() |
任性的高山 · 【已解决】RuntimeError: CUDA error: device-side assert triggeredCUDA kernel errors might be asynchronous- 2 周前 |
![]() |
从容的炒面 · nexus Maven仓库-阿里云 1 周前 |