copyWith method

FdcDataSetFilterContext copyWith({
  1. FdcFormatSettings? formatSettings,
  2. Object? selected = _fdcUnsetFilterContextValue,
})

Returns a copy with changed filter context values.

selected intentionally uses a sentinel parameter so copyWith() keeps the current selection predicate, while copyWith(selected: null) clears it. Passing a non-null value must still be a bool.

Implementation

FdcDataSetFilterContext copyWith({
  FdcFormatSettings? formatSettings,
  Object? selected = _fdcUnsetFilterContextValue,
}) {
  if (!identical(selected, _fdcUnsetFilterContextValue) &&
      selected != null &&
      selected is! bool) {
    throw ArgumentError.value(
      selected,
      'selected',
      'Expected bool, null, or omitted value.',
    );
  }

  return FdcDataSetFilterContext(
    formatSettings: formatSettings ?? this.formatSettings,
    selected: identical(selected, _fdcUnsetFilterContextValue)
        ? this.selected
        : selected as bool?,
  );
}