Why compiler assuming `json['x'] = int?`?
 operator on
Map returns a nullable by spec:
V? operator (Object? key)
The value for the given
keyis not in the map.
So if you are asking for a
key that is not in your
Map you will get a
null value back and not an exception.
If you are 100% sure
json['x'] will always work and want the application to crash in case this is not the case, you can use
json['x']!. Alternative, you need to provide default values or other type of handling in case these values is not in the map.