DEV Community 👩‍💻👨‍💻

Cover image for 5 Flutter Dart Tips.
Dreamy Developer
Dreamy Developer

Posted on

5 Flutter Dart Tips.

1) .any

This is a list of Languages


And you can use the .any to check whether any elements of this iterable to satisfy the test.

In this example we verify if any language starts with the letter D or B

The first one is true and the second one is false.


2) .padRight .padLeft

You can add characters before or after a string if you use the padLeft or padRight.


This number is the total amount of character you will have and


This is what will be added inside your string


You can do the same thing with the padRight.

3) .shuffle()

It is sometimes useful to randomize items inside the list


For this you can use the shuffle and you can see that everything is now randomized.

4) String Multiplication

It is possible to use string multiplication with dart.

This example will print x times your string.
String Multiplication

5) .toSet()

If you have a list of repeated items.


You can use the .toSet() to remove all the duplicates and this is the final result.


Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.