How to Learn Flutter?

Posted in Flutter
How to Learn Flutter?

Flutter is becoming popular because of the flexibility of building apps quickly and the ease of learning the language. Whether you are an experienced developer or a newbie, learning Flutter will just take a few well-informed videos, online and offline learning resources, and a lot of self-learning. In this article, we will guide you through each of them, but before that – you should know what you should know before you know Flutter!

What is Flutter?

Developed by Google, Flutter is an open-source framework (rather SDK) mainly used for developing mobile applications. We can also develop web and desktop versions for the same app using a single codebase. Flutter consists of many beautifully designed widgets, a rich set of motion APIs, and scrolling, navigation, fonts, and icons that work across platforms. This ensures smooth performance both on Android and iOS phones. Flutter applications are natively compiled, thus highly performant and fast. 

Why Should You Learn Flutter?

Mobile app development is the trend of 2020. It is most convenient to view and perform actions on mobile because we can do so from anywhere and at any time. A fully customizable framework that lets you build highly expressive and flexible UI, Flutter is easy to learn and enables faster development. If those are not reasons enough, here are some more reasons why you should learn Flutter:

  • No cross-platform issues: Flutter follows the write-once approach as it is ahead-of-time compiled, thus giving native code experience.
  • No rebuild required: "Hot reload" allows developers to view code changes as soon as they are saved.
  • Great community and support: The flutter team is quite helpful, and the community provides ample support for new learners.
  • Create endless animations using 2Dimension Flare.
  • Support for many IDEs like VS Code, Android Studio, etc.
  • Single code for frontend and backend using Dart language

Features of Flutter

One last thing before we give you the resources to learn flutter, it is important for you to know so that you can just dig into the resources and have hands-on learning without having to go for an introduction yet again!

Some unique features of Flutter are:

  • Focus on Customizable widgets, all sets of widgets from material design and Cupertino pack (rather than android XML) are available to provide hassle-free UI development.
  • Hot reload helps developers see their changes instantly. This reduces development time as well as bug fixing time.
  • Write-once, run anywhere code that runs on any platform without changes. 
  • Flutter uses Dart programming language that uses both ahead of time and just in time compilation giving high performance and faster start up time.
  • Native ARM machine code allows for native performance on both Android and iOS.

Prerequisites for Learning Flutter

Your familiarity with the following is quite necessary to start learning Flutter. If you have no idea about any of the below, it is better to grab those concepts first and then continue with Flutter journey:

  • Knowledge of native Android development: that is if you want to develop very fine and detailed applications 
  • OOPS Concepts: As languages like Java, C++ are based on OOPS concepts, it is important to be thorough with them. Here is a nice video that easily explains OOPS.
  • You should know Dart programming before you can learn Flutter: but that's easy too. Dart is Google's general-purpose programming language. Hackr.io lists some good courses that can help you get on Dart fast and easy.
  • Knowing C++/Java is an added advantage but not mandatory!

How to Learn Flutter?

Now is a good time to start learning Flutter. There are many resources on the internet, and information overload can be overwhelming. That's why we have come up with the best resources that can help you learn Flutter in the right way. There is a lot of documentation available on the official flutter website, but you should refer to other resources for more depth and variety.

1. Online Videos and documentation

A lot of sample videos and documentation are available on the official website.

You should also check out the Widget of the week on YouTube that covers a widget from the SDK. If you need quick hands-on about a widget – this is the place to go.

2. Online tutorials

Hackr's Flutter tutorial link has a list of some of the best free and paid courses. Flutter & Dart is a good course wherein you can learn both Dart and Flutter at once. Similarly, getting started with Flutter is a good beginner's course that you can take up for free.

3. Books

Books are a great way to get in-depth knowledge about any subject as well as reference material. Some of the best books to learn Flutter are:

As a beginner, you should be able to gather much from just these 2 books.

You can start or enhance your Flutter skills using the samples, demos, and examples created by the Flutter community on GitHub. Try the UI examples first, some of them are available on the app store – this will help you view how an application works in real-time.

Okay, we got it

So, I have the resources, but how do I start?

Well, let's start right away!

Let us quickly set up the flutter environment and build a simple app to get you started.

Installing Flutter

The first thing you should have is SDK – Software Development Kit – it is a set of software tools that come in a single package and can be used in your development environment. 

For development, we use an integrated development environment (IDE)– makes your development and testing easy and fast. Like we learned before, there are 2 popular IDEs –

  • VS Code – It is light, fast, and everything that you want an IDE to be! The best one you want to work on.
  • Android Studio – With Android Studio on your device, you just have to install plugins for Flutter and Dart, set up the SDK, and you will be good to go.

Set up is easy, and you can follow the instructions from the official documentation.

Building a simple app using Flutter

Let us build a simple Hello World program. Through this program, we will understand the structure of Flutter, and the main methods used. Although it's too simple an app to be real, it still gives out a good start.

To create a new flutter project, just type

$ Flutter create proj_hello_world

The project will be created with the following structure –

proj_hello_world

android – to generate the Android app. Any Android-specific implementation will go inside this folder.

assets to store data files, images, etc.… 

ios - to generate the ios app. Any iOS-specific implementation will go inside this folder.

Lib – the main code files are created here main.dart – the main file

test – for unit testing purpose

For our simple application, we will need only the 'main.dart.' file. The file comes with some code, and developers mostly delete it to write their code from scratch. This is exactly what we will do too!

The first important thing is to import the 'material' package. It is used to include UI components.

import 'package:flutter/material.dart';

Just like many other languages, execution starts with the main method. The main method should include runApp() method that calls the code to be executed. 

void main() => runApp(new HelloWorldApp());

The code to be executed is nothing but a widget. Remember that Flutter is all about widgets.

So, what is a widget?

If you did not know already, a widget could be anything – button, list, table, input box, card view basically, anything that controls the view. So, your entire Flutter app is a collection of widgets that come together and show up in a nice UI.

That is why every class you create should extend the widget class. Since all our application will do is to print Hello World, we just need a widget that doesn't need to save any state – a stateless widget. A stateless widget should have a build method.

class HelloWorldApp extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
Now comes the main magic –
   return new MaterialApp(
     home: new Material(
       child: new Center(
          child: new Text("Hello world!"),

The MaterialApp is the widget wrapper, of which material is one of the materials, and the center is the Widget that centers the elements. The text adds the text field widget. Apart from the attributes that you see – home, child – there are many other attributes like styling, position, decoration, etc that take care of the entire UI.

Well, let's put all the code together now –

import 'package:flutter/material.dart';
void main() => runApp(new HelloWorldApp());

class HelloWorldApp extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
   return new MaterialApp(
     home: new Material(
       child: new Center(
         child: new Text("Hello world!"),
        ),),);}} 

… and run it using the command

$flutter run

Congratulations! You just built your first app. From here, your Flutter journey would be simple and fun.

Conclusion

There are many good courses designed by Udemy and other online sources for learning Flutter. If you are already into mobile app development, a good course will help you learn quickly so that you can get on board. However, if your project has relaxed timelines, you should do more experiments, try to build your widgets by setting up your local environment and read a book or two to know about more complex designs. Books will help you fill the gaps between what you already know and what you need to learn.

People are also reading:

Ramya Shankar

Ramya Shankar

A cheerful, full of life and vibrant person, I hold a lot of dreams that I want to fulfill on my own. My passion for writing started with small diary entries and travel blogs, after which I have moved on to writing well-researched technical content. I find it fascinating to blend thoughts and research and shape them into something beautiful through my writing. View all posts by the Author

Leave a comment

Your email will not be published
Cancel