Check Mobile App
Read now
Start a Project

Flutter: Use of Dart extension Methods.

Save

Extension Methods:

In this blog, we will check the use of  Dart Extension methods in the flutter. Extension methods, introduced in Dart 2.7.

Sometimes we need additional functionalities which do not provide in existing libraries. We can add our own functionality by using the extension in the existing class of  libraries’ APIs

Extension methods used to add additional functionality to existing libraries’ APIs. We can define extension with methods, getters, setters, and operators.

Extention Syntax:

Extention On String Class:

Let’s check some String Class extension examples.

Extention On List Class:

Let’s check some List Class extension examples.

Using Extention methods:

You need to just import your extensions methods class and call Extention getter using dot(.) on variable

 

I hope this blog will help to add some utility functionality to existing APIs.

Happy Learning 🙂

Reference Links:https://dart.dev/guides/language/extension-methods

 

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

When I think in getting solutions for my Ecommerce Platform, I think of Webkul. They have been such a blessing in our business. We have spent thousands of dollars in support and modules from them. We love their support team. They work very closely with us, and they always go the extra mile when we need help.

Michael Urresta

Michael Urresta

Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home