useScrollController function

ScrollController useScrollController({
  1. double initialScrollOffset = 0.0,
  2. bool keepScrollOffset = true,
  3. String? debugLabel,
})

Creates a ScrollController.

The controller is automatically disposed when the widget is unmounted.

Implementation

ScrollController useScrollController({
  double initialScrollOffset = 0.0,
  bool keepScrollOffset = true,
  String? debugLabel,
}) {
  final c = ScrollController(
    initialScrollOffset: initialScrollOffset,
    keepScrollOffset: keepScrollOffset,
    debugLabel: debugLabel,
  );
  onBeforeUnmount(c.dispose);
  return c;
}