← Flutter tutorial

Flutter

Introduction to Flutter

Flutter is a UI toolkit, written in Dart, for building natively-compiled apps from a single codebase — the same code can ship to iOS, Android, web, and desktop.

Example: the entry point of a Flutter app

import 'package:flutter/material.dart';

void main() {
  runApp(
    const Center(
      child: Text('Hello, Flutter!', textDirection: TextDirection.ltr),
    ),
  );
}

Renders a single line of centered text reading "Hello, Flutter!".

Instead of dragging elements in a visual designer, you describe your UI in code as a tree of widgets, and Flutter draws it. runApp() is the entry point that starts a Flutter app — notice it's ultimately just calling Dart's own main() function from the Dart tutorial, since Flutter apps are, underneath everything, ordinary Dart programs.

Example
import 'package:flutter/material.dart';

void main() {
  runApp(
    const Center(
      child: Text('Hello, Flutter!', textDirection: TextDirection.ltr),
    ),
  );
}
Output
Renders a single line of centered text reading "Hello, Flutter!".