computeMaxScrollOffset method Null safety

  1. @override
double computeMaxScrollOffset(
  1. int childCount
)
override

The scroll extent needed to fully display all the tiles if there are childCount children in total.

The child count will never be null.

Implementation

@override
double computeMaxScrollOffset(int childCount) {
  assert(childCount != null);
  final int mainAxisCount = ((childCount - 1) ~/ crossAxisCount) + 1;
  final double mainAxisSpacing = mainAxisStride - childMainAxisExtent;
  return mainAxisStride * mainAxisCount - mainAxisSpacing;
}