# awesomefluttertips
**Repository Path**: huchong1/awesomefluttertips
## Basic Information
- **Project Name**: awesomefluttertips
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2020-06-24
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# ❤️Awesome Flutter ❤️ tips and tricks ❤️
## #Day1 `stless` & `stful`
We can type `stless` and `stful` and we get Autocomplete Suggestion to generate Stateless Flutter Widget or Stateful Flutter Widget Respectively.
## #Day2 `If Null` Operator (`??`)
`??` checks If something is `null`. If it's not null it returns its own value but if it's `null` it returns the value after `??`
`return abc??10; //returns 10 if abc is null else returns its own value,`
It also has shorthand assignment when it's null.
`abc??=5 //assigns 5 to abc if it's null`
## #Day3 Inner Function
We can define a function inside another function.
This is to encapsulate the inner function from everything else outside the outer function.
## #Day4 ..Cascade..Chaining..Fluent API
We can chain method/member calls without returning `this` from **method(), getter() and setter()** using cascade operator (..)
try in [Dartpad](https://dartpad.dartlang.org/290e17306b745ed83b9242653ca55041)
Can be replaced with
## #Day5 Dart `data class`
Dart does not support data class by default, but with plugins, we can simply generate data class (`copyWith()`,`fromMap()`, `toMap()`, `Named Constructor`, `toString()`,`hashCode()` & `equals()` methods implemented by the tool).
### `🚨❗️Caution❗️🚨` : **Your cursor should be inside the class that you want to generate data class.**

Download Plugins :
[For Android Studio](https://plugins.jetbrains.com/plugin/12429-dart-data-class)
[For VsCode](https://marketplace.visualstudio.com/items?itemName=BendixMa.dart-data-class-generator)
## #Day6 RichText Widget
If you want to have a single text with different style within it? Do not bother or try to hack with with `Text()` and use `RichText()` with `TextSpan()`
[Try on dartpad](https://dartpad.dartlang.org/f87dddb2f48f1d1ef0f25903af1ded58)
[See Youtube Demo](https://www.youtube.com/watch?v=rykDVh-QFfw)

## #Day7 Spacer Widget
Using Container with certain height/width to create responsive space between Widgets? That may look good on one screen but will not look the same in different screen size.
Spacer Widget comes for the rescue. Instead of `Container(width: / height: )`, use `Spacer(flex: )`.
How on this earth did I not know about this widget earlier? This is going to save many lives 😂
[Try on dartpad](https://dartpad.dev/f0d077124527a8078cdb2eede1e9bf73)
[See Youtube Demo](https://www.youtube.com/watch?v=7FJgd7QN1zI)

[___`Tips 1-7`___](README.md)
[__`Next >>`__](week02.md)
[__`Tips 08-14`__](week02.md)
[__`Tips 15-21`__](week03.md)
[__`Tips 22-28`__](week04.md)
[__`Tips 29-35`__](week05.md)
[__`Tips 36-42`__](week06.md)
[__`Tips 43-49`__](week07.md)
[__`Tips 50-56`__](week08.md)
[__`Tips 57-63`__](week09.md)
[__`Tips 64-70`__](week10.md)
[__`Tips 71-77`__](week11.md)
[__`Tips 78-84`__](week12.md)
[__`Tips 85-91`__](week13.md)
[__`Tips 92-98`__](week14.md)