copyWith method Null safety

ScrollBehavior copyWith(
  1. {bool? scrollbars,
  2. bool? overscroll,
  3. Set<PointerDeviceKind>? dragDevices,
  4. ScrollPhysics? physics,
  5. TargetPlatform? platform,
  6. @Deprecated('Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. ' 'This feature was deprecated after v2.13.0-0.0.pre.') AndroidOverscrollIndicator? androidOverscrollIndicator}
)

Creates a copy of this ScrollBehavior, making it possible to easily toggle scrollbar and overscrollIndicator effects.

This is used by widgets like PageView and ListWheelScrollView to override the current ScrollBehavior and manage how they are decorated. Widgets such as these have the option to provide a ScrollBehavior on the widget level, like PageView.scrollBehavior, in order to change the default.

Implementation

ScrollBehavior copyWith({
  bool? scrollbars,
  bool? overscroll,
  Set<PointerDeviceKind>? dragDevices,
  ScrollPhysics? physics,
  TargetPlatform? platform,
  @Deprecated(
    'Use ThemeData.useMaterial3 or override ScrollBehavior.buildOverscrollIndicator. '
    'This feature was deprecated after v2.13.0-0.0.pre.'
  )
  AndroidOverscrollIndicator? androidOverscrollIndicator,
}) {
  return _WrappedScrollBehavior(
    delegate: this,
    scrollbars: scrollbars ?? true,
    overscroll: overscroll ?? true,
    physics: physics,
    platform: platform,
    dragDevices: dragDevices,
    androidOverscrollIndicator: androidOverscrollIndicator
  );
}