Issue type List<Object> is not a subtype of type List<Map<String, Object>> in type cast

Hey Guys,

Im pretty new in Dart/Flutter and Im currently developing an simple Quiz-App to get a fundamental understanding how Flutter/Dart works. But Ive got an issue which I cant fix for hours and almost days.

If I wanna start my Android Emulator it says :

List is not a subtype of type List<Map<String, Object>> in type cast

And that’s probably the code:

@override

Widget build(BuildContext context) {

return Column(

  children: <Widget>[

    Question(

      questions[questionIndex]['questionText'],

    ),

    ...(questions[questionIndex]['answers'] as List<Map<String, Object>>).map((answer) {

      return Answer(() => answerQuestion(answer['score']), answer['text']);

    }).toList()

  ],

);

I look forward to the answeres. :slight_smile:

Hi @Trite, if you’re still having trouble, could you send all the files that include this questions variable?

3 Likes

Thank you for your help… Ive got fixed the problem… There was an issue in my map…

3 Likes

Hello, do you mind sharing what the exact problem was and how you fixed it?