copyWith method

ListState copyWith({
  1. List<String>? ids,
  2. int? total,
  3. String? nextCursor,
  4. String? prevCursor,
  5. bool? hasNextPage,
  6. bool? hasPrevPage,
  7. bool? isFetching,
  8. bool? isFetchingMore,
  9. String? error,
  10. DateTime? lastFetched,
  11. bool? stale,
  12. bool clearError = false,
  13. bool clearTotal = false,
  14. bool clearNextCursor = false,
  15. bool clearPrevCursor = false,
})

Implementation

ListState copyWith({
  List<String>? ids,
  int? total,
  String? nextCursor,
  String? prevCursor,
  bool? hasNextPage,
  bool? hasPrevPage,
  bool? isFetching,
  bool? isFetchingMore,
  String? error,
  DateTime? lastFetched,
  bool? stale,
  bool clearError = false,
  bool clearTotal = false,
  bool clearNextCursor = false,
  bool clearPrevCursor = false,
}) => ListState(
  ids: ids ?? this.ids,
  total: clearTotal ? null : (total ?? this.total),
  nextCursor: clearNextCursor ? null : (nextCursor ?? this.nextCursor),
  prevCursor: clearPrevCursor ? null : (prevCursor ?? this.prevCursor),
  hasNextPage: hasNextPage ?? this.hasNextPage,
  hasPrevPage: hasPrevPage ?? this.hasPrevPage,
  isFetching: isFetching ?? this.isFetching,
  isFetchingMore: isFetchingMore ?? this.isFetchingMore,
  error: clearError ? null : (error ?? this.error),
  lastFetched: lastFetched ?? this.lastFetched,
  stale: stale ?? this.stale,
);