isValueExistObject<T> static method
Check if value in list already exist/not
Implementation
static T? isValueExistObject<T>(
List<T> checkedList,
T newValue, {
required bool Function(T element) check,
}) {
var isExist = false;
for (final list in checkedList) {
if (check(list)) {
isExist = true;
break;
} else {
isExist = false;
}
}
final result = isExist ? null : newValue;
return result;
}