isNullOrBlank static method

bool? isNullOrBlank(
  1. dynamic value
)

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. Checks if data is null or blank (empty or only contains whitespace).

Implementation

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

/// Checks if data is null or blank (empty or only contains whitespace).
static bool? isNullOrBlank(dynamic value) {
  if (isNull(value)) {
    return true;
  }

  // Pretty sure that isNullOrBlank should't be validating
  // iterables... but I'm going to keep this for compatibility.
  return _isEmpty(value);
}