copyWithout method

Tuple copyWithout({
  1. required List<bool> indices,
})

A list of boolean values indicating whether certain items in this tuple should be retained or discarded. The length of the list must be the same as the length of this tuple.

Note: Due to the dynamic nature of this method, the returned tuple will not have typing preserved. This can be fixed by calling asType on the result.

Implementation

Tuple copyWithout({required List<bool> indices}) {
  assert(indices.length == 7,
      'Length of given list must be same length as tuple.');

  var values = <dynamic>[];
  for (var i = 0; i < indices.length; i++) {
    if (indices[i]) {
      values.add(this[i]);
    }
  }

  return Tuple.fromList(values);
}