your first flutter project

In this article, we’re going to create a very simple flutter project called “Hello World”. If you don’t have an environment setup, feel free to check flutter documentation first

Creating your first project

flutter create firstapp
cd firstapp

Editing /lib/main.dart

main.dart is a file which executes for the first time when you open an app. Like a C-Program, Dart also starts with main() as an initial function to execute. inside main() we need to return a runApp() with widgets This example, we have returned a simple Widget called Text()

Text Widget contains a few properties such as string, alignments, directions ..etc. (check out:

Final Code

import 'package:flutter/material.dart';

void main(){
  return runApp(Text('Hello World', textDirection: TextDirection.ltr));

Since, main() return only one function, we can simplify this code as follow

import 'package:flutter/material.dart';

void main() => runApp(Text('Hello World', textDirection: TextDirection.ltr));
Sundaravel M

About the author: Hi! I'm Sundaravel (codesundar), Founder of I have been a Web, Mobile App developer, Author, and Teacher since 2014. I also worked as a software consultant for fortune 500 companies. I created to share my real-time knowledge in various technologies such as PhoneGap, Ionic, Flutter and more.