skip to Main Content

Arguments of a constant creation must be constant expressions.

Arguments of a constant creation must be constant expressions.I am new to flutter, I couldnt find the answer anywhere. i am stuck please help. Arguments of a constant creation must be constant expressions. why this error in that line questions[0]. in the image?

2

Answers


  1. array questions is const, but questions[0] is not const.
    to get rid of error you should remove const word before Expand.

    more about const vs final here

    Login or Signup to reply.
  2. When using variables in this way, you should use ‘final’ instead of ‘const’ and you should update your question list like this:

      final List<String> questions = [
        "Java is a Procedural Language?",
      ];
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search