You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the syntax for incrementing/decrementing a nullable expression (such as the value of a map entry) using the prefix/postfix operators ++ or -- ? I am getting the error shown below.
final map =<int, int>{};
var index =0;
...
if (map[index] ==null){
map[index] =1;
}else{
map[index] = map[index]!+1; // This works.++map[index]!; // Missing selector such as '.identifier' or '[0]'. Try adding a selector.dart(missing_assignable_selector)++(map[index]!); // Missing selector such as '.identifier' or '[0]'. Try adding a selector.dart(missing_assignable_selector)
map[index]!+=1; // Missing selector such as '.identifier' or '[0]'. Try adding a selector.dart(missing_assignable_selector)
}
It seems that the expression map[index]! is not assignable.
The text was updated successfully, but these errors were encountered:
This discussion has been raised in #1113. There is currently no mechanism which will allow you to combine null checks (!) with increment/decrement, but please continue the discussion there.
What is the syntax for incrementing/decrementing a nullable expression (such as the value of a map entry) using the prefix/postfix operators
++
or--
? I am getting the error shown below.It seems that the expression
map[index]!
is not assignable.The text was updated successfully, but these errors were encountered: