Skip to content

Instantly share code, notes, and snippets.

@itog
Created June 9, 2020 06:16
Show Gist options
  • Save itog/55a7dad0bcc7626d1a231f673a239518 to your computer and use it in GitHub Desktop.
Save itog/55a7dad0bcc7626d1a231f673a239518 to your computer and use it in GitHub Desktop.
[dart] extension method
extension MyExtension on int {
String extensionMethod() {
print('extension method');
}
static String staticExtensionMethod() {
print('static extension method');
}
String get extensionGetter => 'extension getter';
static String get staticExtensiongetter => 'static extension getter';
}
void main() {
int i = 0;
i.extensionMethod();
MyExtension.staticExtensionMethod();
print(i.extensionGetter);
print(MyExtension.staticExtensiongetter);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment