'Display events stored in MongoDB in SyncFusion Calendar via GraphQL
I am working on an app and I'd like to display the events that are stored in MongoDB using my GraphQL end points. This is how I do it:
List appointments = Query(
options: QueryOptions(document: gql(_getEvents)),
builder: (result, {fetchMore, refetch}) {
if (result.isLoading) {
return const CircularProgressIndicator();
} else {
result.data!["events"];
}
throw const Text('Something happened');
}) as List;
return _DataSource(appointments);
}
However, I get an error saying that 'The type 'Query is not a subtype of type 'List' in type cast'. Apparently flutter doesn't like that I cast Query as List. The question is 'Is there a way to make the cast work'? Or is there any other applicable workaround?
Thank you in advance
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
