This course was created by London App Brewery. We are pleased to host this content in our library.
Skill Level Beginner
- [Instructor] All right, so the first thing that I want to talk about is, what exactly is Flutter? And to be able to answer this question, we first have to put ourselves into the mind of a mobile app developer, so here's one. This is Bob, and he's an iOS developer. Now, Bob made this really cool app where instead of matching with other people, you get to match with foods, and you get to figure out what food you most want to eat. And it's a super popular app, everybody loves it, but there's just one problem, it's only on iOS, so every other day he gets a question of, when's it coming to Android? When is it coming to Android? When is it coming to Android? And at some point, he finally has had enough and he decides to go and buy loads and loads of books, study Java, study Android development, and finally he's able to have both of these buttons on his website. Get It On Google Play, and Download on the App Store. So, he now has the same app on the Google Play and the App Store. Now, this is great for the users, but for Bob, it means that when he has any updates that he wants to make to the app or any bug fixes, he has to push those both to the Play Store as well as the App Store, so two places now instead of one, and he has to maintain two code bases. So, that's a lot of work down the line. It's basically double the amount of work that he used to have, but that's not all because he gets complaints from users saying that, hey, in your app, some of the layouts look really weird. It doesn't look right. Like, why is this button like twice the size of everything else? What is wrong with your app? Now, this is because not only does he have to support a huge array of different screen sizes and aspect ratios for the iOS ecosystem, the iPads, the iPhones, the older iPhones, but he also now has a whole bunch of Android devices, and because Android devices can be made by literally anybody, the number of different screen sizes is just massive, and it's really hard to keep on top of what are all of the different screen sizes in order to be able to design your app to look good on all of them. Now, here's where Flutter comes in. The guys at Flutter had this question. More and more so, we're seeing screens everywhere. There's screens on fridges, there's screens at the bus stop, there's screens in your mirror, and they're all different aspect ratios and different screen sizes, so why can't we create something that can intelligently and easily allow developers to design beautiful interfaces for all of these different types of screens? And this is exactly what Flutter is. It's simply a toolkit that makes it easy for developers to design beautiful interfaces for all sorts of screen sizes and devices, and it comes with a whole bunch of prebuilt widgets that make it easy to lay out your app, so straightforward things such as laying out your app with rows or with columns or stacks, and it borrows some of the concepts from web design, where you can have things that are centered or have paddings and margins. And what if you could use this system to design and develop for almost any device? Because all that Flutter does is it asks for a blank window on the device. So, be it on Android or iOS or web or desktop, all it's asking for is just a simple blank window, and what Flutter will do is it will draw onto that blank window whatever it is that needs to be rendered and whatever animations or interactions or changes, it's all painted on by Flutter. So, this means that instead of having to make iOS apps the Apple way and make Android apps the Android way, you can simply use a whole bunch of prebuilt widgets from Flutter, such as a FloatingActionButton or a LinearProgressIndicator, and you can simply put these into your app no matter which platform you're working on. And they've even designed widgets that look the part for each platform. So, for example, the alerts might look like this on your Android app, but you can also specify that if your app is being run on iOS, then they should look like this, making your app look like it was created in a native way. This is how Flutter works. You get access to a whole bunch of widgets. So, you can see these widgets as Lego blocks almost, and by plugging them together and customizing it, you end up with your beautiful app that can be deployed almost anywhere. Let's take a look at how easy it can be working with widgets in real life. I've created a blank app, and I'm going to go ahead and add an appBar, and this is a prebuilt widget, which is built by Flutter, and as soon as I hit Save, my app bar gets painted onto the screen. So, I don't like it in blue, so let's customize it to change it to red. So, now I add a Colors widget and I change the color. So, now let's add a Text widget that adds a title to the app bar, and just like Lego, I've plugged together all my widgets and I've managed to build my app bar in a matter of seconds. And there's loads of different widgets that are prebuilt. For example, if you wanted a floating action button, then we just create that widget, and we can customize it by changing its properties, such as the background color or what should go inside it. Piece by piece, widget by widget, I can build up my app and customize it to my liking, with very few lines of code. Now, what if I wanted some functionality? Well, I can simply create a variable to keep track of, say, the number of donuts that I've eaten in a day, and I can change my Text field to embed that number variable in there. And then, all that happens is, when the user presses on the red button, then it will increase the number of donuts that I've eaten, and Flutter makes it incredibly easy to build a beautiful interface for our app using these widgets as well as allowing us to customize the widgets to our liking. And finally, building functionality on top of those widgets is also as simple as updating a number of variables, and that, we're going to dive into. So, now that I've created my donut counter app, the best part is, I can now deploy that code to all sorts of different devices and platforms without having to rewrite the code or learn a new technology, a new skill, or a new programming language.