Flutter First application

To create a flutter project, Open android studio and select “Create New Flutter Project” option.

flutter-first-project

As we are going to create a flutter App, we need to select the “Flutter Application” option and click on the “Next” button.

flutter-new-application

This screen will appear, here
  • Project name: Here it will put the project name, make sure the project name should be lower case.
  • Flutter SDK path: We need to set a path to the flutter SDK folder, which we already downloaded.
  • Project location: Where the project will save.
  • Description: This is optional, here we can describe the project.
Then click the “Next” button.

flutter-new-application-set

After that, this screen will appear, here we need to add the project package name, which should be unique to publish in the app store and play store.

Then click on the “Finish” button.

flutter-new-application-finish

It will open this screen, it already has some code in the “main.dart” file. Clear all codes in “main.dar” file and add this following code.

import 'package:flutter/material.dart';

void main(){
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Text("Hello World"),
        ),
      ),
    );
  }
}
Run the app and it will show like this.

flutter-new-application-output

Subscribe Now