'type 'Future<dynamic>' is not a subtype of type 'Map<DateTime, List<Event>>'
Hi I'm trying to convert a Future list into a LinkedHashMap and I'm having But I'm returning a Future Dynamic
This is my class
class Event {
final String calendarDatesStart;
final String eventTitle;
const Event(this.calendarDatesStart, this.eventTitle, );
@override
String toString() => eventTitle;
}
// Gets the Future
var datasource = const FutureCalendarEvents();
getCalendarDataSource() async {
return await datasource.getCalendarFuture();
}
My function to return the Map
// Add dates to eventsMap ??
myDates () async {
var eventsMap = <DateTime, List<Event>>{};
List myDatesEvents = await getCalendarDataSource();
for(var item in myDatesEvents){
print(item);
eventsMap.update(DateTime(item.calendarDatesStart),
item.calendarEventName);
}
return eventsMap;
}
And here is where it takes my events
// Takes my events
final kEvents = LinkedHashMap<DateTime, List<Event>>(
equals: isSameDay,
hashCode: getHashCode,
)..addAll(eventsMap);
And this is what I end up with
Thanks for any help I've been at this a long time trying to work it out.
This is the plugin on Flutter I'm trying to work with https://pub.dev/packages/table_calendar
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

