Your First Flutter Project


I teach how to build apps using ionic and flutter

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));