“Hello World” in Flutter

Set up environment

Setup IDE

Creating Project in Flutter

flutter create helloworld

Structure of Flutter Project

main.dart

import 'package:flutter/material.dart';
  1. Stateless Widget
  2. Stateful Widget
void main() {
runApp(object_of_a_Widget);
}
void main() {
runApp(new HelloWorld());
}

class HelloWorld extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container();
}
}
class HelloWorld extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'First Example',
home: Scaffold(
appBar: AppBar(
title: Text('Home Page'),
),
body: Center(
child: Text('Hello World'),
),
),
);
}
}
import 'package:flutter/material.dart';

void main() {
runApp(new HelloWorld());
}

class HelloWorld extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'First Example',
home: Scaffold(
appBar: AppBar(
title: Text('Home Page'),
),
body: Center(
child: Text('Hello World'),
),
),
);
}
}

Run the App

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store