Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:02,540 --> 00:00:08,210
So let's dive into Flutter then and for this, let's create a brand new project. For that,
2
00:00:08,210 --> 00:00:11,780
open up your terminal or command prompt on your machine,
3
00:00:11,810 --> 00:00:17,840
so the default MacOS terminal or your windows command prompt and in there, make sure that with the help
4
00:00:17,840 --> 00:00:24,710
of the cd command which allows you to change directories, you navigate into the path where you want to create
5
00:00:24,710 --> 00:00:25,930
that new project,
6
00:00:25,940 --> 00:00:29,350
so here I navigated into a playground folder for example.
7
00:00:29,390 --> 00:00:35,020
It doesn't matter how you name that folder but it should be the path where all your project files are stored
8
00:00:35,020 --> 00:00:40,010
thereafter or where this new project folder is created in to be precise.
9
00:00:40,010 --> 00:00:44,870
Once you're in that path, we can use the Flutter command which is available since we installed the Flutter
10
00:00:44,870 --> 00:00:52,490
SDK in the first course module and we can run the create command there to create a new Flutter project in
11
00:00:52,490 --> 00:00:55,330
that place where we navigated too.
12
00:00:55,370 --> 00:00:59,370
So now with that, you can give this project anything you want,
13
00:00:59,390 --> 00:01:04,180
like flutter_course or I'll name it flutter_complete_guide,
14
00:01:04,280 --> 00:01:05,350
the name is up to you
15
00:01:05,490 --> 00:01:10,440
and this just wrapped over two lines, so it's one name here.
16
00:01:10,520 --> 00:01:15,740
Make sure that in that name however, you only have one word,
17
00:01:15,770 --> 00:01:17,090
so flutter_complete_guide,
18
00:01:17,090 --> 00:01:21,590
it's one word where the individual words are separated with underscores.
19
00:01:21,590 --> 00:01:27,250
Don't use dashes or blanks there, that will not be allowed and you'll get an error, instead
20
00:01:27,440 --> 00:01:30,030
use underscores for that project name
21
00:01:30,200 --> 00:01:37,640
and this will then go ahead once you hit enter and scaffold out this new Flutter project for you.
22
00:01:37,640 --> 00:01:43,440
So now this creates this new folder, the flutter_complete_guide folder in the path where you navigated
23
00:01:43,440 --> 00:01:45,860
to and inside of that folder,
24
00:01:45,890 --> 00:01:51,920
it gives you all the base set up for a new Flutter project and by the end, you should see an output that looks
25
00:01:52,010 --> 00:01:53,010
something like this,
26
00:01:53,030 --> 00:01:58,940
you can ignore warnings you might be getting here if Flutter doctor basically showed you the same,
27
00:01:58,940 --> 00:02:05,210
it should work here and now you can run these two commands to navigate into that newly created Flutter
28
00:02:05,210 --> 00:02:10,250
project folder and to then also run your Flutter project.
29
00:02:10,250 --> 00:02:12,200
However I'll not do that here,
30
00:02:12,200 --> 00:02:18,470
instead I opened up the project here in Visual Studio Code which is the IDE I'll be using throughout the
31
00:02:18,470 --> 00:02:19,280
course.
32
00:02:19,280 --> 00:02:25,460
Now as you learned in the first course section, you can use either Visual Studio code with the Flutter
33
00:02:25,520 --> 00:02:32,750
extension installed as we did it in the first course section or you use Android Studio which is also absolutely
34
00:02:32,750 --> 00:02:33,610
fine,
35
00:02:33,620 --> 00:02:39,340
however I prefer Visual Studio Code and therefore, that's the IDE I will use throughout this course.
36
00:02:39,350 --> 00:02:41,240
Now this is Visual Studio Code
37
00:02:41,240 --> 00:02:45,920
just configured as I showed it in the first course section, nothing else
38
00:02:45,920 --> 00:02:51,320
and this is this Flutter project which we just created here in the command line, so this is a project
39
00:02:51,520 --> 00:02:55,040
and all the default files and folders we get in there.
40
00:02:55,340 --> 00:03:02,150
Now in the next lecture, I will walk you through all these folders and files and explain what they do
41
00:03:02,150 --> 00:03:05,560
and with which files we will work mostly
42
00:03:05,660 --> 00:03:12,070
but first of all, let's make sure that we can also see our app not just in code but on a device and for
43
00:03:12,070 --> 00:03:15,380
that, you could use a real device connected to your machine
44
00:03:15,380 --> 00:03:22,310
and of course I also will show you how that works in detail later but for now, let's simply use an emulator,
45
00:03:22,550 --> 00:03:30,440
a virtual device and I will pick a virtual Android device since that works on both Windows and MacOS and
46
00:03:30,440 --> 00:03:35,300
Linux whereas iOS devices, iOS simulators,
47
00:03:35,360 --> 00:03:38,960
iPhone simulators only work on MacOS. Nonetheless
48
00:03:38,990 --> 00:03:45,290
later down the course, I will also show you how to run this app on an iOS simulator so you will also
49
00:03:45,290 --> 00:03:52,880
learn that. Now to launch the app onto an Android emulator, we first of all need to create an emulator
50
00:03:53,340 --> 00:03:58,910
and for that, you should start Android Studio which you had to install anyways and you should see that
51
00:03:58,910 --> 00:04:00,330
welcome screen there.
52
00:04:00,620 --> 00:04:07,190
Now in there if you click on configure, you should have the option to choose the AVD Manager.
53
00:04:07,190 --> 00:04:14,660
If you don't have that option here, you can open an existing Android Studio project and there, simply
54
00:04:14,660 --> 00:04:17,620
navigate to the Flutter project you just created,
55
00:04:17,630 --> 00:04:23,390
so that's the Flutter project I created with Flutter create and in there, choose your Android folder
56
00:04:23,450 --> 00:04:27,430
as an Android project because that is a real Android project
57
00:04:27,440 --> 00:04:31,250
that's part of your Flutter project, of your Flutter app.
58
00:04:31,250 --> 00:04:33,940
Now once this opens, you could write code here,
59
00:04:33,980 --> 00:04:38,870
Android code which we certainly don't want to do, we want to write Flutter and Dart code and get an Android
60
00:04:38,870 --> 00:04:39,830
app automatically,
61
00:04:40,460 --> 00:04:46,370
I only opened this because here under tools once this initialization here finished which will take
62
00:04:46,370 --> 00:04:47,390
a couple of seconds,
63
00:04:47,570 --> 00:04:50,180
you'll also find that AVD Manager.
64
00:04:50,210 --> 00:04:58,810
So in case you didn't see that on the welcome screen, then you can go here to tools and find the AVD
65
00:04:58,810 --> 00:04:59,810
Manager here.
66
00:04:59,860 --> 00:05:02,110
So you should find it in either of the two places,
67
00:05:02,110 --> 00:05:08,260
if you find it in neither of these places, you should try to reinstall the Android SDK and possibly the
68
00:05:08,260 --> 00:05:13,120
entire Android Studio but once you found it and you opened it, you should see a screen that looks something
69
00:05:13,120 --> 00:05:13,810
like this,
70
00:05:13,960 --> 00:05:19,630
here I already got a couple of virtual devices, you might not have them yet and you can simply create
71
00:05:19,630 --> 00:05:23,490
a new one with the button here in the lower left corner,
72
00:05:23,860 --> 00:05:30,130
if you click on create virtual device. Now in here, you can create different virtual devices and we'll use
73
00:05:30,130 --> 00:05:35,310
a phone in this course for testing and you have different blueprints here,
74
00:05:35,320 --> 00:05:39,520
for example you can create a Pixel 2 or Pixel 3 device,
75
00:05:39,550 --> 00:05:41,420
you've got other blueprints here,
76
00:05:41,590 --> 00:05:46,600
also depends on the point of time you're watching this, you've got really old or small devices as well which
77
00:05:46,600 --> 00:05:51,390
we'll also use for testing later, to see if our app works well on these devices as well.
78
00:05:52,090 --> 00:05:57,970
But for the moment, I'll go with the Pixel 2 and I would recommend that you also pick an image where you
79
00:05:57,970 --> 00:06:00,700
have this image here next to play store,
80
00:06:00,700 --> 00:06:04,720
this play button style here because if you have that icon here,
81
00:06:04,720 --> 00:06:11,290
that means that this image actually comes with certain extra services installed which make development
82
00:06:11,290 --> 00:06:14,040
with things like Google Maps and so on easier
83
00:06:14,080 --> 00:06:19,000
or which makes testing these features easier and that will help us later down the course,
84
00:06:19,000 --> 00:06:24,460
however you could also launch a new simulator with that feature once we need it and go with a different
85
00:06:24,460 --> 00:06:25,030
one for now.
86
00:06:25,600 --> 00:06:30,340
Nonetheless, I will go with the Pixel 2 here and click next thereafter.
87
00:06:30,340 --> 00:06:36,550
Now you can install and you should install a system image which is basically the Android version that
88
00:06:36,550 --> 00:06:38,460
runs on the device.
89
00:06:38,560 --> 00:06:42,700
Now I would recommend that you use the latest stable version here.
90
00:06:42,760 --> 00:06:45,700
Now I could use Android queue here
91
00:06:45,700 --> 00:06:49,000
and when you're viewing this, this might already be the latest version
92
00:06:49,180 --> 00:06:55,590
but right now when I'm recording this video here, this is the latest Android version that is available,
93
00:06:55,590 --> 00:07:02,370
the latest stable Android version and I don't want to develop for an unstable or under development version
94
00:07:02,370 --> 00:07:05,550
where certain features might not work and therefore I'll use this.
95
00:07:05,580 --> 00:07:10,260
Now if you don't have that already, you might need to simply download this image first by clicking that
96
00:07:10,260 --> 00:07:11,470
download button.
97
00:07:11,610 --> 00:07:16,530
So choose that latest stable version here and click next again
98
00:07:16,630 --> 00:07:22,590
and now you can give this emulator a name if you want to, I'll stick to default and all the default settings
99
00:07:22,590 --> 00:07:24,350
here should be fine.
100
00:07:24,420 --> 00:07:29,750
You could configure some advanced things but only do that if you really know what you're doing,
101
00:07:29,760 --> 00:07:34,930
I will instead go with all the defaults and then click finish
102
00:07:35,160 --> 00:07:39,900
and now this creates this new virtual device, adds it to the list here and now you can always launch it
103
00:07:39,900 --> 00:07:41,910
here by clicking that play button.
104
00:07:41,940 --> 00:07:43,530
So that's exactly what I'll do here,
105
00:07:43,590 --> 00:07:49,290
I'll click that play button here and this will bring up that new virtual device which is now booting
106
00:07:49,290 --> 00:07:56,370
up here. This is the virtual device on which we will now run our app as soon as it is done booting up.
107
00:07:56,390 --> 00:07:56,890
Here we go,
108
00:07:56,900 --> 00:07:58,330
this just finished booting
109
00:07:58,370 --> 00:08:04,730
and now if we go back here into our project, we can run this Flutter app on this device.
110
00:08:04,850 --> 00:08:07,110
Now for running this, we got a couple of options.
111
00:08:07,190 --> 00:08:12,040
You can open up the terminal in here by going into your menu here and clicking on new
112
00:08:12,040 --> 00:08:13,020
terminal
113
00:08:13,220 --> 00:08:15,290
and this is now your normal system
114
00:08:15,290 --> 00:08:21,470
terminal or command prompt just running inside of Visual Studio Code and it automatically navigated
115
00:08:21,470 --> 00:08:22,630
into this project folder,
116
00:08:22,660 --> 00:08:26,000
so you don't have to do this manually with the cd command.
117
00:08:26,000 --> 00:08:32,030
Now here, you can run Flutter run and it will run your app and it should automatically find this application
118
00:08:32,030 --> 00:08:32,810
here.
119
00:08:32,840 --> 00:08:34,370
You could absolutely do that
120
00:08:34,490 --> 00:08:39,710
but with the help of this IDE and the Flutter extension which we installed in the first course section,
121
00:08:40,220 --> 00:08:43,560
we get an even more convenient way of running our app.
122
00:08:43,760 --> 00:08:49,550
You can go to debug here and now you have two options of starting your app,
123
00:08:49,550 --> 00:08:55,430
you can start it in debugging mode or either by clicking here or by using this shortcut here
124
00:08:55,550 --> 00:09:01,340
and this is something I'll show you later in a separate module where I will show you how you can debug
125
00:09:01,370 --> 00:09:05,390
your Flutter application and find and fix errors.
126
00:09:05,420 --> 00:09:11,090
You can also run it without debugging, which is a bit faster because with debugging, a lot of extra features
127
00:09:11,120 --> 00:09:12,260
get added to your app
128
00:09:12,260 --> 00:09:19,940
so to say for debugging only and if you run it in non-debug mode, you simply have a bit of a faster app
129
00:09:20,000 --> 00:09:26,530
which is a bit nicer for normal development. That can be run by clicking here or using this shortcut
130
00:09:26,540 --> 00:09:30,200
and if you click this, it should also automatically spot your device,
131
00:09:30,200 --> 00:09:35,510
however first of all you have to choose, at least if you have multiple different extensions installed,
132
00:09:36,830 --> 00:09:39,320
with which environment you want to run your code
133
00:09:39,320 --> 00:09:40,820
and that would be Dart and Flutter here,
134
00:09:40,820 --> 00:09:42,890
so choose that if you are prompted
135
00:09:42,890 --> 00:09:48,230
and now it will auto-detect the emulator and launch this application that we have in this folder here
136
00:09:48,620 --> 00:09:50,620
on that device.
137
00:09:50,630 --> 00:09:57,440
So as you can see here in the bottom right, it's now building the project with the help of Android Studio
138
00:09:57,440 --> 00:09:59,170
and the Android SDK
139
00:09:59,360 --> 00:10:07,060
and here, the top right, you have that control bar which allows you to control the execution of this app.
140
00:10:07,070 --> 00:10:09,950
You can always stop it by clicking that red stop button,
141
00:10:10,100 --> 00:10:17,090
you can reload the app, restart the app on the device with that green refresh icon. You can hot reload
142
00:10:17,090 --> 00:10:24,200
with that flash and hot reload means that changes that you made are added to the already running application
143
00:10:24,200 --> 00:10:29,810
which is a really cool feature Flutter supports for development, makes development much faster because
144
00:10:29,810 --> 00:10:36,530
you don't have to restart your app all the time. You can also pause if you want and you can then these buttons
145
00:10:36,530 --> 00:10:38,670
are helpful for debugging later.
146
00:10:38,840 --> 00:10:40,660
That's the control panel we'll get here
147
00:10:40,850 --> 00:10:47,390
and the build process here takes a couple of seconds up to minutes. The first time you run this subsequent
148
00:10:47,570 --> 00:10:52,580
reloads, when you change something in code and you want to see that in the device or on the device, that
149
00:10:52,580 --> 00:10:53,660
will be much faster,
150
00:10:53,660 --> 00:10:56,850
so it's just that first load which takes a while.
151
00:10:56,930 --> 00:11:03,680
So let's wait for this first launch to finish here, in the meantime, let me also mention that it probably
152
00:11:03,770 --> 00:11:06,440
automatically switched here to the debug console,
153
00:11:06,440 --> 00:11:09,500
so not the terminal anymore but the debug console
154
00:11:09,500 --> 00:11:15,080
and that is the console where you will see all the output whilst the app is running, so any errors will
155
00:11:15,080 --> 00:11:16,040
be shown here
156
00:11:16,040 --> 00:11:22,070
but also some system messages which you might want to print will also be shown here and we'll work with
157
00:11:22,070 --> 00:11:24,290
this quite a bit to fix errors
158
00:11:24,290 --> 00:11:30,800
we might be getting or to see a certain output to validate that everything is working correctly in our
159
00:11:30,800 --> 00:11:32,290
application.
160
00:11:32,330 --> 00:11:33,980
So here it's now starting up,
161
00:11:33,980 --> 00:11:40,100
these are all default log messages which we're seeing here and you should then see your app run on
162
00:11:40,100 --> 00:11:47,030
that emulator as I do it here and you then can press this button here in the bottom right corner to
163
00:11:47,120 --> 00:11:49,140
interact with your application.
164
00:11:49,160 --> 00:11:54,780
Now the first time this is loaded, the first few clicks, it might be a bit slow here but thereafter, it should be
165
00:11:54,860 --> 00:11:57,600
back to normal interaction speed.
166
00:11:57,620 --> 00:12:04,000
So this is the Flutter app which we just created running on that emulator and this is the code or the
167
00:12:04,000 --> 00:12:06,400
project in which we'll work on the code.
168
00:12:06,400 --> 00:12:12,160
Speaking of that, let's now walk through all the folders and files we have here and understand what they're
169
00:12:12,160 --> 00:12:13,120
doing.
18198
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.