See all Blogs

Shahroz Bakht

Flutter Project Setup | Develop an Application with Flutter – Part 2

Before we begin composing the code of our application, we need to set up the environment.

First download the most recent stable arrival of the Flutter SDK for your OS.

IDE

Now install an IDE (Integrated Development Environment). We will utilize Android Studio. Flutter likewise gives official plugins to IntelliJ and Visual Studio Code. For Android Studio and IntelliJ, remember to restart the IDE to enact the recently installed plugins.

Start Flutter Project and select Flutter Application.

Flutter

Provide the basic details and path of Flutter SDK.

Flutter

Set the unique domain name for the package.

Flutter

Project has been created. Now build it!

Key to success: doctor

Open the terminal (Alt+F12 in Android Studio) and run the flutter doctor command to check the current environment is accurate or not.

To run the application, we need to have usable Flutter, at any rate one working IDE, and an associated device.

Android

On account of an actual Android gadget, it should be connected through a USB cable.

On account of an Android emulator, we need to make a virtual gadget. To begin with, we should open the AVD supervisor by either utilizing the symbol on the toolbar or clicking Ctrl+Alt+F12 (Cmd+Alt+F12 on macOS) and composing the activity name.

Flutter

Leave default settings on the following screens:

Flutter Flutter

It's an ideal time to run our application! Pick the ideal gadget or emulator and press Shift+F10 (Ctrl+R on macOS) or utilize the Run button.

Flutter

iOS:

For iOS simulator, open it utilizing the dropdown device menu:

Flutter

The Xcode installer will provoke you to introduce the missing parts. The simulator appears and opens up on the device menu.

Things are somewhat more confounded on account of an actual iOS device. Suppose that the device is associated through a USB link and unlocked, we first need to open the iOS module in Xcode:

Flutter

From Signing and Capabilities settings tab, add a new team:

Flutter

Sign in to your Apple ID. Subsequent to shutting the Accounts window, provisioning profiles will be produced.

If you get an error like this:

Flutter

It means somebody is now utilizing your identifier. Change the Bundle Identifier worth to something different.

After configuration, run the application from Android Studio. The first endeavor will fail because the provisioning profile isn't trusted on the device. You need to confide in it in Profiles and Device Management settings.

Now you can launch the application from the home screen.

Launch

Now our application should resemble this:

Flutter

Now write some code. Utilize the Hot reload option (Ctrl+\ or Alt+\ on macOS) to apply changes right away.

Ideal approach to source code:

We’ll utilize the git repository facilitated on GitHub. Go to https://github.com/new, pick your project name and affirm. Don’t tick initialize this repository with a README choice since readme file is already in the project? We additionally suggest making the SSH keypair and enrolling the public key on GitHub.

Then, we can create a local repo. Utilize the VCS - > VCS Operation pop up menu choice (Alt+' or Ctrl+V on macOS),choose the Create Git repository choice, and affirm default location.

Flutter

A few filenames got red:

Flutter

That implies they aren't committed yet. Write "Initial commit" and affirm or you can type (git add - A) and git commit commands in the terminal.

Now push the commit on the remote server. Press Ctrl+Alt+K (Cmd+Alt+K on macOS) and characterize new remote.

Your code will be accessible on the remote repo. You can check it online on https://github.com/user name/repository name.

  See all Blogs