filled method

bool filled(
  1. String key
)

True when the key is in the input and is not empty: not null, not a blank string, not an empty list or map. Dot keys work.

req.filled('name');

Implementation

bool filled(String key) {
  dynamic val = _find(key).value;
  if (val == null) return false;
  if (val is String) return val.trim().isNotEmpty;
  if (val is Iterable) return val.isNotEmpty;
  if (val is Map) return val.isNotEmpty;
  return true;
}