PagingParams constructor

PagingParams([
  1. dynamic skip,
  2. dynamic take,
  3. dynamic total
])

Creates a new instance and sets its values.

  • skip the number of items to skip.
  • take the number of items to return.
  • total true to return the total number of items.

Implementation

PagingParams([dynamic skip, dynamic take, dynamic total])
    : total = BooleanConverter.toBooleanWithDefault(total, false) {
  this.skip = IntegerConverter.toNullableInteger(skip);
  this.take = IntegerConverter.toNullableInteger(take);

  // This is for correctly using PagingParams with gRPC. gRPC defaults to 0 when take is null,
  // so we have to set it back to null if we get 0 in the constructor.
  if (this.take == 0) this.take = null;
}