Created
September 1, 2022 22:28
-
-
Save Temidtech/c585292e9610be819fa711e03ed3a321 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Imagine you have code like this: | |
class Employee { | |
final double salary; | |
Employee(this.salary); | |
} | |
class SoftwareEngineer extends Employee { | |
final String level; | |
SoftwareEngineer(final double salary, this.level) : super(salary); | |
} | |
// Super initializers, a new language feature in Dart 2.17, | |
// allow you to express SoftwareEngineer's constructor in a more condensed style: | |
class SoftwareEngineer extends Employee { | |
final String level; | |
SoftwareEngineer(super.salary, this.level); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
implement super initializers