Flutter First Application

Now we are going to develop the first flutter application.
Here we are using Android Studi IDE.

Start Android studio
Select File-> New Flutter Application
Select Flutter Application and press Next
Set the Flutter SDK path
Enter your Flutter Project name
Click Finish

 

 

 

 

Now your flutter first application will ready.

Flutter folder structure

Android -> Android application related files will be here.
ios -> ios application related files will be here.
lib ->  This is our main file for flutter application.
Here we are going to write our flutter widgets.

test
pubspec.yaml
pubspec.lock

lib contains main.dart file.
Each flutter class will ends with dart extension.
main.dart is the entry point for the application

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

first line indicates, it will import the necessary files to run the flutter application.
main()-> This is the first method will executes while running the application.

above line of code represent the Lambda expression, we can write above code like below
void main(){
    runApp(MyApp());
}
whenever their is single line of code inside {} braces we can write that like above.
compiler not through any errors.
 

  class MyApp extends StatelessWidget {
    // This widget is the root of your application.
   @override
    Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
       home: Center(
        child: Text("First Flutter Demo Application"),
       )
     );
   }
  }

Now you can run your first flutter widget