isListValuesAllEquals function

bool isListValuesAllEquals(
  1. Object? list, [
  2. Object? eqValue
])

Returns true if list elements are all equals to value.

Implementation

bool isListValuesAllEquals(Object? list, [Object? eqValue]) {
  if (list == null || list is! List) return false;
  if (list.isEmpty) return false;

  eqValue ??= list.first;

  return listMatchesAll(list, (v) => v == eqValue);
}