DEV Community

loading...
Innovation Incubator

FLUTTER : DART CHEAT SHEET- Write Smart Code

tkpranav profile image tkpranav Originally published at Medium on ・2 min read

FLUTTER : DART CHEAT SHEET- Write Smart Code

While writing a long code for some functionality, you know that there will be an easier way to do it.

You might find a few of that in this post or maybe a hint.

This is just the icing, there are many of these functionality pre-built for you.

1. Cascades

Normal Way:

Smart Way:

2. Null -aware operator

Normal Way:

Smart Way:

3. Ternary Operator

Normal Way:

Smart Way:

4. Null -aware operator

Normal Way:

Smart Way:

5. Assert Statement

Normal Way:

Smart Way:

6. Index in List

Normal Way:

Smart Way:

7. Getters

Normal Way:

Smart Way:

8. Exceptions

Smart Way:


Discussion (0)

pic
Editor guide