setActiveOrder method

bool setActiveOrder(
  1. String orderId
)

Sets the active sort order by ID and re-sorts the current items.

Returns true if the order was found and set, false otherwise.

Example:

cubit.setActiveOrder('price'); // Sort by price
cubit.setActiveOrder('name');  // Sort by name

Implementation

bool setActiveOrder(String orderId) {
  if (_orders == null) {
    _logger.w('Cannot set active order: no orders collection configured');
    return false;
  }

  if (_orders!.setActiveOrder(orderId)) {
    _logger.d('Active sort order changed to: $orderId');
    _applySortingToCurrentState();
    return true;
  }

  _logger.w('Sort order not found: $orderId');
  return false;
}