PagingParams class

Data transfer object to pass paging parameters for queries.

The page is defined by two parameters:

  • the skip parameter defines number of items to skip.
  • the take parameter sets how many items to return in a page.
  • additionally, the optional total parameter tells to return total number of items in the query.

Remember: not all implementations support the total parameter because its generation may lead to severe performance implications.

Example

var filter = FilterParams.fromTuples(["type", "Type1"]);
var paging = new PagingParams(0, 100);

myDataClient.getDataByFilter(filter, paging, (err, page) {...});

Constructors

PagingParams([dynamic skip = null dynamic take = null dynamic total = null ])
  • 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.
  • PagingParams.fromJson(Map<String, dynamic> json)
    Creates a new instance from json. [...]
    factory

    Properties

    skip ↔ int
    The number of items to skip.
    read / write
    take ↔ int
    The number of items to return.
    read / write
    total ↔ bool
    The flag to return the total number of items.
    read / write
    hashCode → int
    The hash code for this object. [...]
    read-only, inherited
    runtimeType → Type
    A representation of the runtime type of the object.
    read-only, inherited

    Methods

    fromJson(Map<String, dynamic> json) → void
    Initialize this object from JSON Map object
    getSkip(int minSkip) → int
  • Gets the number of items to skip.
      • minSkip the minimum number of items to skip.
    • Returns the number of items to skip.
  • getTake(int maxTake) → int
  • Gets the number of items to return in a page.
      • maxTake the maximum number of items to return.
    • Returns the number of items to return.
  • toJson() → Map<String, dynamic>
    Returned JSON Map object from values of this object
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a non-existent method or property is accessed. [...]
    inherited
    toString() → String
    Returns a string representation of this object.
    inherited

    Operators

    operator ==(dynamic other) → bool
    The equality operator. [...]
    inherited

    Static Methods

    fromMap(dynamic map) PagingParams
  • Creates a new PagingParams and sets it parameters from the specified map
      • map a AnyValueMap or StringValueMap to initialize this PagingParams
    • Returns a newly created PagingParams.
  • fromTuples(List tuples) PagingParams
  • Creates a new PagingParams from a list of key-value pairs called tuples.
      • tuples a list of values where odd elements are keys and the following even elements are values
    • Returns a newly created PagingParams.
  • fromValue(dynamic value) PagingParams
  • Converts specified value into PagingParams.
      • value value to be converted
    • Returns a newly created PagingParams.