Flutter
Search…
01 Flutter: Hello World

Displaying Hello World on the screen

main.dart
1
import 'package:flutter/material.dart';
2
3
void main() {
4
runApp(
5
new Center(
6
child: new Text(
7
'Hello, world!'
8
),
9
),
10
);
11
}
Copied!

Hello World app using a Stateless widget

1
import 'package:flutter/material.dart';
2
3
void main() {
4
runApp(
5
new MaterialApp(
6
title: 'Hello World App',
7
home: new myApp(),
8
)
9
);
10
}
11
12
class myApp extends StatelessWidget {
13
@override
14
Widget build(BuildContext context) {
15
return new Scaffold(
16
appBar: new AppBar(
17
title: new Text('Hello World App'),
18
),
19
body: new Center(
20
child: new Text(
21
'Hello, world!'
22
),
23
),
24
);
25
}
26
}
Copied!