Giter Club home page Giter Club logo

awesomefluttertips's Introduction

❤️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.

statful

#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

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.

functions

#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

cascade

Can be replaced with

cascadeafter

#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.

dataclass

Download Plugins :

For Android Studio

For VsCode

#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

See Youtube Demo

richtext

#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

See Youtube Demo

spacer

Tips 1-7 Next >>

Tips 08-14 Tips 15-21 Tips 22-28 Tips 29-35 Tips 36-42 Tips 43-49 Tips 50-56 Tips 57-63

awesomefluttertips's People

Contributors

erluxman avatar triallax avatar rootsec1 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.