Skip to content

Instantly share code, notes, and snippets.

@Temidtech
Created September 1, 2022 22:28
Show Gist options
  • Save Temidtech/c585292e9610be819fa711e03ed3a321 to your computer and use it in GitHub Desktop.
Save Temidtech/c585292e9610be819fa711e03ed3a321 to your computer and use it in GitHub Desktop.
// 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);
}
@Temidtech
Copy link
Author

implement super initializers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment