If you want to create a static Extension method in Dart As of now January 2020, Dart 2.7 officially introduced extension methods. To extend a class, this can be done:
1 2 3 4 5 | extension NewExtension on double { int get myMethod { return (1/this*10).toInt(); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.