flutter/the dart extensions code example
Example 1: dart extension
extension FancyNum on num {
num plus(num other) => this + other;
num times(num other) => this * other;
}
Example 2: dart extension function
extension NumberParsing on String {
int parseInt() {
return int.parse(this);
}
// ···
}