Created
June 9, 2020 06:16
-
-
Save itog/55a7dad0bcc7626d1a231f673a239518 to your computer and use it in GitHub Desktop.
[dart] extension method
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
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