如何在flutter中将动态类型的事件列表更改为我自己的类型?

How to change the list of events of dynamic type into my own type in calendar in flutter?

我正在使用 table 日历来存储列表中的事件。默认列表是 List<dynamic> 类型,但我想要的是将事件存储在另一个 List<EventStore> 类型的列表中。 当我将动态更改为 EventStore 类型时,一切顺利。
我是这样做的,
Map<DateTime, List<EventStore>> _events;

但是在选择特定日期时,它会给出错误,例如
type 'List<dynamic>' is not a subtype of type 'List<EventStore>'

为了显示所选日期的事件列表,我已经这样做了,

 onDaySelected: (date, events) {
                setState(() {
                  _selectedEvents = events;
                });
              },

_selectedEventsList<EventStore> 类型,而 eventsList<dynamic> 类型。
如何将其更改为EventStore类型?
看看这个 repo github repo

你可以像这样在 Dart 中转换 Lists

List<dynamic> data = [1, 2, 3, 4]
List<int> dataAsInts = data.cast<int>();

有关详细信息,请查看 docs 中的 cast() 方法。