parent property Null safety

ScrollPhysics? parent
final

If non-null, determines the default behavior for each method.

If a subclass of ScrollPhysics does not override a method, that subclass will inherit an implementation from this base class that defers to parent. This mechanism lets you assemble novel combinations of ScrollPhysics subclasses at runtime. For example:

const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics())

will result in a ScrollPhysics that has the combined behavior of BouncingScrollPhysics and AlwaysScrollableScrollPhysics: behaviors that are not specified in BouncingScrollPhysics (e.g. shouldAcceptUserOffset) will defer to AlwaysScrollableScrollPhysics.

Implementation

final ScrollPhysics? parent;