copyWithNull method

CollectionState copyWithNull({
  1. bool query = false,
  2. bool globalSearchQuery = false,
  3. bool sort = false,
})

Copies the object with the specific fields set to null. If you pass false as a parameter, nothing will be done and it will be ignored. Don't do it. Prefer copyWith(field: null) or CollectionState(...).copyWith.fieldName(...) to override fields one at a time with nullification support.

Usage

CollectionState(...).copyWithNull(firstField: true, secondField: true)

Implementation

CollectionState copyWithNull({
  bool query = false,
  bool globalSearchQuery = false,
  bool sort = false,
}) {
  return CollectionState(
    dataRows: dataRows,
    model: model,
    currentPage: currentPage,
    totalPages: totalPages,
    isLoading: isLoading,
    isError: isError,
    notFoundAnything: notFoundAnything,
    query: query == true ? null : this.query,
    globalSearchQuery:
        globalSearchQuery == true ? null : this.globalSearchQuery,
    sort: sort == true ? null : this.sort,
    filtersBackup: filtersBackup,
  );
}