Fireship · @fireship
Top 12 Flutter Tips & Tricks
Uploaded June 3, 2019 · Length 9:32
Summary
Learn 12 Flutter tips and tricks for building efficient and maintainable apps, including code auto-completion, refactor tool, animations, and performance optimization.
- flutter development
- flutter tips and tricks
- flutter animations
- flutter performance optimization
- dart programming
- flutter widgets
- flutter ui design
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
you may have heard the flutter is almost
- 0:01
like magic when it comes to building
- 0:03
native apps so you decided to jump on
- 0:05
the flutter train but now you find
- 0:06
yourself
- 0:06
refactoring this giant nested nightmare
- 0:08
of widgets luckily flutter has a whole
- 0:10
bunch of tricks up its sleeve so you
- 0:12
should never have to battle with code
- 0:13
like this in today's video we'll look at
- 0:15
12 different strategies for building
- 0:16
efficient and maintainable flutter apps
- 0:18
if you're new here like and subscribe
- 0:20
and leave a comment below for a chance
- 0:21
to win this t-shirt or my first trick
- 0:23
I'll show you how to write code
- 0:25
automatically using nothing but the tab
- 0:27
key in the mouse I talked about this in
- 0:29
detail in my full flutter course which
- 0:30
you can access as a pro member but there
- 0:32
are a few things that you absolutely
- 0:33
must know if we take a look at this code
- 0:35
snippet you can see a lot of closing
- 0:37
tags on a single line making it very
- 0:39
hard to understand but you can easily
- 0:40
fix this by adding trailing commas to
- 0:42
your arguments and lists and the end
- 0:44
result is an easy to read tree structure
- 0:46
when we format the file but doing this
- 0:48
manually all the time would get really
- 0:49
annoying that's why you should get
- 0:50
really good at using the tab key because
- 0:52
the tooling is so good in dart and
- 0:54
flutter that almost everything can be
- 0:55
auto-completed with intellisense just
- 0:57
hover over the thing you want hit tab
- 0:58
and the trailing column will be added
- 1:00
for you
- 1:01
[Music]
- 1:07
but the most powerful tool you have at
- 1:09
your disposal is the refactor tool it
- 1:11
allows us to insert new widgets into the
- 1:13
widget tree especially commonly used
- 1:15
ones like container and center and we
- 1:16
can also use it to remove widgets
- 1:17
without having to think about where the
- 1:19
opening and closing characters are and
- 1:21
if the widget tree starts to become too
- 1:22
deeply nested that usually means we need
- 1:24
to refactor out into our own state list
- 1:26
or stateful widget and the refactor tool
- 1:28
can easily handle that while also
- 1:29
setting up a constructor with the
- 1:31
necessary input properties so you should
- 1:33
really never have to write a custom
- 1:34
widget from scratch now tip number two I
- 1:37
learned from Robert Brune heggs YouTube
- 1:38
channel which you should definitely be
- 1:39
subscribed to if you're using flutter
- 1:41
you won't be able to use the vs code
- 1:43
refactor tool in every situation but
- 1:44
there's still a few things you can do to
- 1:46
make your life easier first install the
- 1:47
awesome flutter snippets from gnash rom
- 1:49
dial that will give you shortcuts to
- 1:51
generate things like stateful and
- 1:53
stateless widgets then when you run into
- 1:55
issues with your code you can hit
- 1:56
control period to run a quick fix a
- 1:58
common example is when you're adding


