verifyOrThrow method

void verifyOrThrow(
  1. CollectionWidgetStateType type
)

Implementation

void verifyOrThrow(CollectionWidgetStateType type) {
  final ok = switch (type) {
    CollectionWidgetStateType.list => this is InfiniteListOptions,
    CollectionWidgetStateType.sliverList => this is SliverInfiniteListOptions,
    CollectionWidgetStateType.animatedList => this is AnimatedInfiniteListOptions,
    CollectionWidgetStateType.animatedSliverList => this is AnimatedSliverInfiniteListOptions,
    CollectionWidgetStateType.grid => this is InfiniteGridOptions,
    CollectionWidgetStateType.sliverGrid => this is SliverInfiniteGridOptions,
  };

  if (!ok) {
    throw ArgumentError('Wrong options type for "$type". Got ${runtimeType.toString()}.');
  }
}