1
**I have a problem with this code:** The receiver can't be null, so the null-aware operator '?.' is unnecessary. this is appear when I execution the above code

image

please help me if u know anything about this problem

    var activeVoteId = Provider.of<VoteState>(context).activeVote?.voteId ?? '';
Jahidul Islam
  • 11,435
  • 3
  • 17
  • 38
suzan emad
  • 21
  • 2

1 Answers1

1

activeVote initialize with null-able and remove the late keyword. Otherwise, initialize when you declare the activeVote

DataType ? activeVote;

if you use follow the the given example

late DataType  activeVote = initValue;
//like
late String value = "";

Jahidul Islam
  • 11,435
  • 3
  • 17
  • 38