copyWith method

GroupsLoaded copyWith({
  1. List<Group>? groups,
  2. bool? hasMore,
  3. bool? isLoadingMore,
  4. Set<String>? selectedGroups,
  5. String? searchKeyword,
})

Create a copy of this state with updated fields (Requirement 1.4)

This method enables immutable state updates by creating a new instance with only the specified fields changed.

Implementation

GroupsLoaded copyWith({
  List<Group>? groups,
  bool? hasMore,
  bool? isLoadingMore,
  Set<String>? selectedGroups,
  String? searchKeyword,
}) {
  return GroupsLoaded(
    groups: groups ?? this.groups,
    hasMore: hasMore ?? this.hasMore,
    isLoadingMore: isLoadingMore ?? this.isLoadingMore,
    selectedGroups: selectedGroups ?? this.selectedGroups,
    searchKeyword: searchKeyword ?? this.searchKeyword,
  );
}