Reputation: 624
ExtractedWidgetForLst({
Key key,
@required List<Expense> expensesData,
}) : _expensesData = expensesData, super(key: key);
If we need any argument to be passed to the class, we use parameterized constructor and in that we use super() to call parent constructor inside the body if needed. and if we don't need calling super then just we use this keyword in the parameter itself, e.g:
class MyClass{
String name;
String surname;
MyClass({this.name,this.surname});
}
but what does operator ' : ' and super means over this scenario.
Upvotes: 2
Views: 64
Reputation: 123
:
is for the parameter and super(key: key);
calls the Constructor from the inherited Widget class
Upvotes: 2