Flutter error: The argument type 'Object?' can't be assigned to the parameter type 'String'

Viewed 4665

So I started learning dart and flutter and during watching some course I ran into this error. Have something been changed in flutter, why is it not working? Also I'm sorry if I didn't attach something needed, I'm new in this world. Thanks!

error part

Column (
    children: [

  Pytanie(
    pytania[_indekspytan]['tekstPytan'],
  ),

and here is the whole column

Column(

children: [

  Pytanie(
    pytania[_indekspytan]['tekstPytan'], 
  ),

  ...(pytania[_indekspytan]['odpowiedzi'] as List<String> ).map((odpowiedz)   { //kropki zapobiegaja tworzeniu 2 listy, podmienia wartosci

    return Odpowiedz(_odpowiedzi,  odpowiedz);

  }).toList()


],



),
1 Answers

What about using toString()

Pytanie(
    pytania[_indekspytan]['tekstPytan']?.toString() ?? ''
),
Related