android - Flutter 中的 device_calendar 更新缓慢
问题描述
我正在 Flutter 中开发一个调度应用程序,并尝试使用 device_calendar ( https://pub.dev/packages/device_calendar ) 包来获取、更新和创建事件。不幸的是,需要很长时间才能更新事情的进展。我得到这样的日历事件:
List<Event> calendarEvents = [];
await Future.forEach(calendars, ((Calendar calendar) async {
var singleCalendarEventsResult =
await _deviceCalendarPlugin.retrieveEvents(calendar.id,
RetrieveEventsParams(startDate: startDate, endDate: endDate));
List<Event> singleCalendarEvents =
singleCalendarEventsResult.data as List<Event>;
calendarEvents.addAll(singleCalendarEvents);
}));
其中 _deviceCalendarPlugin 是此处声明的当前状态的属性:
late DeviceCalendarPlugin _deviceCalendarPlugin;
EventsListState() {
_deviceCalendarPlugin = DeviceCalendarPlugin();
}
没有错误,只是在任何新事件或日历更改出现之前大约需要 5 分钟,即使这些更改是在应用程序中进行的(而它们几乎会立即出现在 Google 日历上)。这是使用设备日历的一般限制,还是我这样做的方式有问题?有没有办法触发设备日历的刷新?我正在通过 USB 调试使用我的实际 Pixel 4a android 手机进行调试。
谢谢你的帮助!!
编辑:我现在也尝试使用 manage_calendar_events 包,同样的问题。添加了一个新日历,但 15 分钟后它没有显示在我的日历页面上,即使它显示在设备上的 Google 日历中。
解决方案
推荐阅读
- r - 通过 R 中的 strsplit() 与列表进行比较,将列添加到 df
- grails - Grails 4 服务没有被注入到 Grails 数据服务中
- sql - SQL 从 wp_metadata 和 wp_users 中提取数据
- python - 如何从 cmd 运行 anaconda 脚本
- c# - 如何在 c# .net 中使用 syncfusion 创建 pdf
- angular - 如何在 Angular 中从 Konva.js 增加打字稿变量
- javascript - window.showOpenFilePicker polyfill
- yahoo-finance - 使用 Inspect 从图表中提取数据
- ios - Flutter - 推送通知以调试模式出现在 iOS 中,但不在发布模式下
- c - 我希望有人可以指导我,这样我就可以学习精通c