Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,970 --> 00:00:05,200
In the last section, we finished up our app, but there's a couple of highlights I want to share with
2
00:00:05,200 --> 00:00:05,400
you.
3
00:00:06,130 --> 00:00:10,330
We covered a ton of stuff throughout this application, so I'm just going to share some of the most
4
00:00:10,330 --> 00:00:15,490
important things I want you to keep in mind as we start to move on to our next step for self import
5
00:00:15,490 --> 00:00:16,020
statements.
6
00:00:16,360 --> 00:00:21,880
So we saw three different types of import statements, imports, where we try to pull a code from another
7
00:00:21,880 --> 00:00:26,200
package where we try to pull code from another file that you and I write and where we try to pull a
8
00:00:26,200 --> 00:00:27,810
code from the standard library.
9
00:00:28,150 --> 00:00:33,130
We're going to continue to write import statements of all three types on all the following applications
10
00:00:33,130 --> 00:00:33,640
that we make.
11
00:00:34,610 --> 00:00:40,040
Next up, what was probably the most confusing thing in this application difference between a state
12
00:00:40,040 --> 00:00:46,880
list and a state full widget, stateless widgets are used any time we want to have just a presentation
13
00:00:46,880 --> 00:00:50,180
widget, something that just takes data and shows it on the screen.
14
00:00:50,960 --> 00:00:55,760
Every time that widgets data changes, we throw that instance of the widget away and construct a new
15
00:00:55,760 --> 00:01:01,130
one with a new set of data, which is why over inside of our image list, we had marked this images
16
00:01:01,130 --> 00:01:02,330
field as being final.
17
00:01:02,820 --> 00:01:07,790
That meant to say that when our image list right here receives that list of images, that's it.
18
00:01:07,790 --> 00:01:08,810
That's the end of it.
19
00:01:08,960 --> 00:01:11,060
Never going to get a list of images again.
20
00:01:11,630 --> 00:01:17,450
If we need to render the list of images, we're going to throw away our existing instance of the widget
21
00:01:17,600 --> 00:01:19,160
and recreate a brand new one.
22
00:01:20,670 --> 00:01:26,280
Inside of our app file over here, we have created a stateful widget because this thing had some data
23
00:01:26,280 --> 00:01:30,300
tied to it that we did not want to throw away when this widget got rendered.
24
00:01:30,940 --> 00:01:36,630
I remember when we make that stateful widget, we're actually kind of showing two things inside of our
25
00:01:36,630 --> 00:01:37,440
widget tree.
26
00:01:37,620 --> 00:01:38,760
Where is that diagram?
27
00:01:39,450 --> 00:01:40,260
Right here.
28
00:01:41,400 --> 00:01:46,950
So when we use that stateful widget, we still get a widget inserted into the actual widget tree, but
29
00:01:46,950 --> 00:01:51,810
that thing has sets or state called on it, which creates a new instance of that app.
30
00:01:51,810 --> 00:01:57,870
State class that outstay class kind of exists outside of our widget tree and it does not get thrown
31
00:01:57,870 --> 00:02:00,390
away whenever the app gets rendered.
32
00:02:02,310 --> 00:02:08,850
We use that app state widget to save some data to it that we didn't want to throw away any time, anything
33
00:02:08,850 --> 00:02:10,110
change inside of our application.
34
00:02:10,500 --> 00:02:15,750
So these two fields right here were not marked with final because we wanted to be able to change them
35
00:02:15,750 --> 00:02:16,320
over time.
36
00:02:17,600 --> 00:02:22,790
Now, the next big thing that we spoke about was asynchronous code handling inside of DART, so we made
37
00:02:22,790 --> 00:02:26,840
use of the async O8 syntax to wait for the future.
38
00:02:26,840 --> 00:02:29,980
They got return from this call right here to resolve.
39
00:02:30,470 --> 00:02:33,250
Then once that thing got resolved, we then took the data from it.
40
00:02:33,680 --> 00:02:35,420
We pulled the JSON out of it.
41
00:02:36,050 --> 00:02:39,470
We use JSON Decode right here to turn it into a map.
42
00:02:39,830 --> 00:02:45,410
And remember, a map is like a JavaScript object or a ruby hash or just a typical map data structure.
43
00:02:46,410 --> 00:02:53,100
We then had made that image model to look at that map and pull certain fields out of it and try to assign
44
00:02:53,100 --> 00:02:55,230
types to some of the properties that were in there.
45
00:02:55,710 --> 00:02:59,590
Now, again, we did not have to strictly make this image model right here.
46
00:03:00,060 --> 00:03:05,700
We made it because it allows us to apply more typing, more like, you know, programmatic typing,
47
00:03:05,700 --> 00:03:11,100
not like physical keyboard typing to our application, which generally makes our code a little bit easier
48
00:03:11,100 --> 00:03:11,760
to maintain.
49
00:03:13,240 --> 00:03:19,900
So we made that image model, we then were able to cause our app state, which it to cause the entire
50
00:03:19,900 --> 00:03:23,620
application to render itself by calling set state right here.
51
00:03:25,040 --> 00:03:29,810
OK, so that's kind of the big high points I want to mention, we covered the important statements,
52
00:03:29,810 --> 00:03:33,500
states less and stateful widgets and asynchronous code that we added in.
53
00:03:34,010 --> 00:03:38,360
Now, one last thing I want to share with you about stateful and stateless widgets.
54
00:03:38,660 --> 00:03:45,040
All the state stuff around flutter is by far one of the most chaotic pieces of flutter right now.
55
00:03:45,500 --> 00:03:51,080
There's a whole variety of different patterns for managing data and changing data within your application.
56
00:03:51,800 --> 00:03:57,650
This idea of stateful and stateless widgets is just one method of many that has been proposed and flutter.
57
00:03:58,310 --> 00:04:03,140
But the stateful stuff, although it seems kind of complicated, is the way that is kind of recommended
58
00:04:03,140 --> 00:04:05,070
by default by the authors of Flutter.
59
00:04:05,750 --> 00:04:09,440
There are other patterns that are recommended by the Flutter team as well.
60
00:04:09,470 --> 00:04:13,670
And we're going to look at another one of those patterns in a later application that we're going to
61
00:04:13,670 --> 00:04:16,940
tackle now, this other way of handling all the state stuff.
62
00:04:16,940 --> 00:04:23,270
Honestly, my personal belief is it's pretty darn complicated, but we're going to work through it together.
63
00:04:23,270 --> 00:04:28,250
And I think at the end of the day, you will learn a lot not only about state management and flutter,
64
00:04:28,250 --> 00:04:30,930
but you'll also learn a lot about general programming stuff as well.
65
00:04:31,130 --> 00:04:37,160
So even though that later state stuff is more complicated, you will learn a lot about general programming
66
00:04:37,160 --> 00:04:37,580
stuff.
67
00:04:37,580 --> 00:04:38,780
So I'm really excited to get there.
68
00:04:39,140 --> 00:04:41,120
OK, so enough enough for review.
69
00:04:41,120 --> 00:04:42,230
Let's take a quick pause.
70
00:04:42,230 --> 00:04:44,870
We'll continue in the next section and start up our next application.
71
00:04:45,110 --> 00:04:46,420
So I'll see you in just a minute.
7356
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.