Without seeing the rest of your code - are you passing BubbleIndicatorPainter() a valid PageController() object?
It looks like your source is from here?
If you're compiling with null-safety a variable that can be null will have a declaration with a "?" suffix. From the link above, pageController is defined as non-nullable.
final PageController pageController;
If it could be null the declaration would be:
final PageController? pageController;
Looking at build() in the linked source, pageController.position is accessed without a null check, so you can't have a null pageController.
The 'default' in the error is a default value in the declaration, which is 'implicitly' null if not provided. For example:
class MyClass {
Color color;
MyClass({this.color = Colors.white});
}
The "implicit default" of "color" is "Colors.white" - the value that gets assigned if you don't provide one to MyClass(), i.e.:
MyClass myclass = MyClass(color: Colors.blue); //myclass.color will be Colors.blue
MyClass myclass = MyClass() // myclass.color will be Colors.white
If instead MyClass was:
class MyClass {
Color? color;
MyClass({this.color});
}
The implicit default value of color would be 'null' because no default is provided (which is allowed because it's declared with a "?" suffix). I.e.:
MyClass myclass = MyClass(color: Colors.blue); //myclass.color will be Colors.blue
MyClass myclass = MyClass() // myclass.color will be null
Looking at BubbleIndicatorPainter() it doesn't provide a default value for this.pageController, which means the implicit default is 'null' (which isn't allowed because it doesn't have a "?" after the type.)