Home > Net >  Invalid radix-10 number (at character 1) null ^
Invalid radix-10 number (at character 1) null ^

Time:12-03

is there a solution to this problem?? *

Link Full Code -> click here

Invalid radix-10 number (at character 1) null ^

enter image description here

  child: Column(
            children: [
              ...(question[questionIndex]['answer']as List<Map<String,Object>>).map((value){
                return Answer(()=> answerQuestion(int.parse(value['Score'].toString()))! ,value['text'].toString());
              }).toList() ,



            ],
          ),

CodePudding user response:

This FormatException gets thrown when int.parse tries to parse a String that does not contain numbers only. In your case, value['Score'] is null, which is definitely not a number.

So to fix your error you need to either

  • Check value['Score'] for null and, if it is null, not try to parse it
  • Make sure that it contains a valid, parseable number (Maybe you meant the lowercase value['score']?)
  • Related