removeDuplicateProperties<T extends Model> static method
Returns a new list from source
by removing duplicate properties with
keys equal to k
.
Implementation
static List<T> removeDuplicateProperties<T extends Model>(
Iterable<T> source,
String k,
) {
final temp = List.of(source);
final properties = <dynamic>{null};
temp.removeWhere((m) {
final json = m.toJson();
final property = json[k];
if (properties.contains(property)) {
return true;
}
properties.add(property);
return false;
});
return temp;
}