Prerequisites for Flutter development
Before we start installing the flutter we first go through the needs to build our flutter apps for android or iOS. First of all, we need a computer which can be either mac or windows. Next, we need some sort of code editors to run our dart code for this we can use either android studio or vs code. It is better to use android studio because we can use an emulator and we can also easily upgrade the android. Though you use vs code there are some cases where we should use android studio so it is better to stick to one platform "Android Studio". The next thing is to run our android app either we need an emulator or an android phone( If you have an 8GB or less ram laptop it is better to use an android phone). If you want to test an iOS app then there is a problem, either if you want to test it on a physical apple phone or a simulator we should need a mac. Basically, the iOS simulator runs only on a mac so to develop an iOS app we should need some sort of mac. In a summary, if you want to build an android app you should need mac or pc, an android studio and Android emulator, or a physical device. If you want to build an iOS app then you should need a mac, android studio, and iOS simulator or a physical device.
Installation on Windows
To install flutter you should need a pc of Windows 7 or later and at least 10GB of free space on your hard disk. First things first we should need a flutter SDK you can get it and all the installation steps from https://flutter.dev/docs/get-started/install/windows. Go to the above link and click on windows and note that if you are from China where Google services are disabled you can use flutter by clicking the link https://flutter.dev/community/china. If you don't have git installed first install it by clicking on this https://git-scm.com/download/win. Once the git is installed double click on it and keep all the default settings and just click on next to the end. Once that is done now you can download the Flutter SDK by clicking on the big blue button. Once the download is finished open up the zip file and click on the extract all and the place where we extract is very important as the Flutter recommends directly use the file path in C drive (ex. c:\src\flutter) don't use the path like c:\program files where it requires the special access to use the files in it, extract files to the location. Once it is completed now you can run the flutter commands by clicking on flutter_console.bat then the command prompt opens up and the flutter commands like a flutter --version etc. Path variable should be set to access the commands by opening the command prompt, to do that search for an edit environment variable in your search bar, under User variables click on the path, and then click on edit, then click on new and specify the path as c:\src\flutter\flutter\bin and then click ok. If you don't have a path variable then click on new, set name as the path, and add the variable value to it once you are done click on ok.
How to install and setup Android Studio
If you already have android studio installed on your pc then just update it to the latest version and if you don't have it then just download it from this link https://developer.android.com/studio and then go ahead and click on download android studio. Once it is downloaded simply install it on your windows machine. Once you are done the android studio opens up and you can see the welcome screen then click on configure, go to plugins tab and search for flutter and click on install, accept any popup in this process. Once it is done restart the android studio for the effects to take place. Then you can see the brand new welcome page and there you can see a line as "Start a new flutter project".
Setting Emulator
Click on start a new flutter project and then click on flutter application and then next, on the next popup give your project name and flutter SDK path as c:\src\flutter\flutter and click on next and click on finish. Once that's done you can see an opened file name as main. dart which contains some sample code written by the flutter team. To run our code we need to set up an emulator which is in the AVD manager( which is located in the top right corner with a small phone symbol and android icon combined), click on it then click on create a virtual device. Choose a phone of your wish and click on next, now choose the android version and click on next, once the download is finished then click on finish. Select your android version and click on next then in emulated performance in graphics select hardware and then click finish. Now it is all done and if you want to see it go ahead and click on the play button of your emulator and it will launch and then click on the play button which is on the rightmost and right of the main. dart and to see the progress of your app it will appear on the console, once it is completed the app will open on your emulator, and you can now play with it.
Setting up physical device
First, connect your phone to the pc and then click on transfer files. Now open the setting in your phone scroll down and click on about phone then locate the build number and tap on it for 7 times and then it will show a message as you are a developer. Now come back to settings, search for developer options, then scroll down and click ok on the tab "Verify apps over USB". Once it is done you can see your phone model name on your android studio app.
Top comments (1)
cool article! If you are interested in this topic, then look here dev.to/pablonax/flutter-templates-...