withQueryParameter function

CoffeeQueryFilter withQueryParameter(
  1. dynamic type,
  2. dynamic value
)

Creates a filter for query parameters.

type: The parameter to filter by, either a String or a Function. value: The value to set the parameter to.

Returns a CoffeeQueryFilter configured for query parameters.

Usage Example

withQueryParameter('name', 'Espresso')
withQueryParameter((Model model) => model.name, 'Latte')

Implementation

CoffeeQueryFilter withQueryParameter(dynamic type, dynamic value) {
  final propertyName = _getPropertyName(type);
  return CoffeeQueryFilter(
    expression: '$propertyName=$value',
    type: 'parameter',
  );
}