You can do a simple if, else in a single line here is the example:
myVar == null ? 0 : myVar //If myVar is null then is 0, else then myVar
Last updated 2 years ago