difference function Null safety

List difference(
  1. List array,
  2. List values
)

Creates an array of array values not included in the other given arrays using SameValueZero for equality comparisons. The order and references of result values are determined by the first array.

Implementation

List difference(List array, List values) {
  return array.where((element) => !values.contains(element)).toList();
}