match static method

String? Function(dynamic) match(
  1. String otherValueGetter(), {
  2. String message = "Values do not match",
})

Implementation

static String? Function(dynamic) match(
  String Function() otherValueGetter, {
  String message = "Values do not match",
}) {
  return (value) {
    if (value == null) return null;
    final other = otherValueGetter();
    if (value.toString() != other) return message;
    return null;
  };
}