Hello World Program In Flutter using Android Studio.
We have prepared a program for the Hello world in flutter using android studio.The hello world program is simple program we take one text in center that name is Hello World.Coming from an Android development background using Java and Kotlin, getting accustomed to the syntax of Dart and using Flutter took me no time. My first experiences playing around with them were actually quite a delight. hopefully this article will gear you up to start your Flutter journey.
We use this configuration:
- Android Studio: Android Studio 3.6.3
- Flutter SDK
- Android Virtual Device: Google Pixel 7.1
- API Level : 25 ( Please start the emulator before the debugging of the program.)
Let us see how to make a simple flutter program for hello world.
Step 1: Open Android Studio and click on start a new flutter project.
Step 2: there is first option of simple application then second option is flutter plugins then third option of flutter package and fourth option is flutter module but in this program we need just flutter application. so select flutter Application and then Click on Next Button.
Step 3: Insert project name then second option add flutter SDK path this path is extracted Flutter SDK and check or edit project location and then click on next button.
Step 4: there is option of package name it is very important to make project then click on finish Button.
Step 5: Copy this code and paste in main.dart android studio.
import 'package:flutter/material.dart';
void main() {
runApp( HelloWorld());
}
class HelloWorld extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'First App',
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.purple,
title: Text('First Program of Hello World'),
),
body: Center( child: Text('Hello World',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.purple,
fontSize: 25.0 ),
),
),
),
);
}
}
Screenshot of coding.
Step 6: start the android virtual device to run the flutter code.
Step 7: Run the Android Virtual Device.
Step 8: Run code of the program hello world.
Step 9: output of the program.
Observations
- This example creates a Material app. Material is a visual design language that is standard on mobile and the web. Flutter offers a rich set of Material widgets.
- The
main()
method uses arrow (=>
) notation. Use arrow notation for one-line functions or methods.
- The app extends
Stateless Widget
which makes the app itself a widget. In Flutter, almost everything is a widget, including alignment, padding, and layout.
- The
Scaffold
widget, from the Material library, provides a default app bar, title, and a body property that holds the widget tree for the home screen. The widget sub tree can be quite complex.
- A widget’s main job is to provide a
build()
method that describes how to display the widget in terms of other, lower level widgets
- The body for this example consists of a
Center
widget containing a Text
child widget. The Center widget aligns its widget subtree to the center of the screen.
main()
method uses arrow (=>
) notation. Use arrow notation for one-line functions or methods.Stateless Widget
which makes the app itself a widget. In Flutter, almost everything is a widget, including alignment, padding, and layout.Scaffold
widget, from the Material library, provides a default app bar, title, and a body property that holds the widget tree for the home screen. The widget sub tree can be quite complex.build()
method that describes how to display the widget in terms of other, lower level widgetsCenter
widget containing a Text
child widget. The Center widget aligns its widget subtree to the center of the screen.
If you’re the one looking for the best Mobile app development solutions you can totally rely on AppClues Infotech – A foremost mobile app development company in the USA. They have helped diverse businesses to build top mobile apps tailored to your specific requirements.
ReplyDeleteiOS App Development Company
Android App Development Company
Cross-Platform App Development Company
Enterprise App Development Company
MCommerce Mobile App Development Company
Wallet App Development Company