I'm trying to create a list of objects - from SpaceX - where each object is a clickable link that leads to a details page, but I keep getting this error:
"type 'Future<List>' is not a subtype of type 'List' in type cast"
My Classes:
- main.dart: https://pastebin.com/EdxdM7GR
- MyApp.dart: https://pastebin.com/bzH0b73C (this is where the error is - I think)
- Launch.dart: https://pastebin.com/0aygjZm7 (mostly generated from app.quicktype.io, WARNING: 800+ lines of code, only included for completeness)
- Services.dart: https://pastebin.com/B4fKJywk
More specifically, I believe the error comes from line 22, in MyApp.dart:
futureLaunch = fetchLaunch() as Future<Launch>;
since that's the only place I cast anything as anything... but I have no idea how to fix it. Every time I change it, I only wind up with new errors.
Attempted fixes:
- tried to follow this walkthrough, which got me a bunch of new errors - once those were corrected, I was back at the same error.
- looked at 3 different stackoverflow questions/answers
none of which managed to help.
- watched this video, which is where I found app.quicktype.io, but ultimately didn't help me solve the error.