CockpitPage<T> constructor

CockpitPage<T>({
  1. required Iterable<T> items,
  2. String? nextCursor,
  3. int? totalCount,
})

Creates a CockpitPage.

Implementation

CockpitPage({required Iterable<T> items, this.nextCursor, this.totalCount})
  : items = List<T>.unmodifiable(items) {
  if (this.items.length > cockpitFoundationPageSizeMaximum) {
    throw const FormatException('Page cannot contain more than 100 items.');
  }
  if (nextCursor != null) {
    CockpitFoundationValueReader.opaqueToken(nextCursor, r'$.nextCursor');
  }
  if (totalCount != null && totalCount! < this.items.length) {
    throw const FormatException('Page totalCount is smaller than items.');
  }
}