Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 27, 2022 04:56 pm GMT

5 Flutter Dart Tips.

1) .any

This is a list of Languages

.any

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.

result

2) .padRight .padLeft

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

padleft

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

total

This is what will be added inside your string

string

You can do the same thing with the padRight.

3) .shuffle()

It is sometimes useful to randomize items inside the list

shuffle

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

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.

toset

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

res


Original Link: https://dev.to/dreamyplayer/5-flutter-dart-tips-28pn

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To