nil method Null safety

dynamic nil(
  1. dynamic s
)

In dart2js (in flutter v1.17) a var by default is undefined. Use this only if you are in version <- 1.17. So we assure the null type in json convertions to avoid the "value":value==null?null:value; someVar.nil will force the null type if the var is null or undefined. nil taken from ObjC just to have a shorter sintax.

Implementation

static dynamic nil(dynamic s) => s == null ? null : s;