'Flutter : Error NoSuchMethodError, I don't understand why?

answerControllers = new Map<String, dynamic>();

List<dynamic> answersToQuestion =
            getAnswersOfQuestion(answers, question["id"]);

        if (!answerControllers.containsKey(question["id"])) {
          answerControllers[question["id"]] = new Map<dynamic, dynamic>();
          if (previousValue == null) {
            for (dynamic answer in answersToQuestion){
              answerControllers[question["id"]][answer["libelle"]]['checked'] = false;
            }

And I got this error :

The following NoSuchMethodError was thrown building CreateDemandView(dirty, state: _CreateDemandViewState#d56fe): The method '[]=' was called on null. Receiver: null Tried calling: []=("checked", false)



Solution 1:[1]

make sure in question["id"] there is a value

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mee Mihoyo