notEmpty static method

String? notEmpty(
  1. dynamic value, {
  2. String msg = 'O campo não pode ser vazio.',
})

Implementation

static String? notEmpty(
  dynamic value, {
  String msg = 'O campo não pode ser vazio.',
}) =>
    switch (value) {
      null => msg,
      Iterable<dynamic> _ =>
        value.isEmpty || notEmpty(value.first, msg: msg) != null ? msg : null,
      Map<dynamic, dynamic> _ => value.isEmpty ||
              notEmpty(value.keys.first, msg: msg) != null ||
              notEmpty(value.values.first, msg: msg) != null
          ? msg
          : null,
      _ => value.toString().isEmpty ? msg : null
    };