I want to initialize super constructor in my dart. the code I want is like this:
class ChildClass extends ParentClass{ ChildClass(){ var startNumber = 4; var endNumber = 8; super(startNumber, endNumber); } } but, it will not work in dart code.
Alternative 1:
class ChildClass extends ParentClass{ ChildClass() : super(4,8); } the problem with alternative 1 is that it is not clean code. what is 4 and 8?
Alternative 2:
class ChildClass extends ParentClass{ int sNumber = 4; int eNumber = 8; ChildClass() : super(sNumber, eNumber); } the problem with alternative 2 is that the field sNumber and eNumber is redundant because we can use startNumber and endNumber from ParentClass if that field is public
Alternative 3:
class ChildClass extends ParentClass{ ChildClass({Int startNumber = 4, int endNumber = 8}) : super(startNumber, endNumber); } the problem with Alternative 3 is that we can change the value of parameter startNumber and endNumber
How can I call the super constructor while making clear the meaning of the values being passed?