Chapter 3
“Hello” from Flutter
IN THIS CHAPTER
Running your first Flutter app
Adding text and images
Improving your app's layout
♪ “Hello, I Must Be Going” ♪
BERT KALMAR AND HARRY RUBY, SUNG BY GROUCHO MARX, IN ANIMAL CRACKERS, 1930
According to legend, the first computer program to print nothing but “Hello world!” was written by Brian Kernighan, as part of the BCPL programming language documentation. The first public appearance of such a program was in Kernighan and Ritchie's 1972 book, The C Programming Language. Nowadays, the term Hello world program, or simply Hello program, applies to any dirt-simple code for someone’s first exposure to a new language or new framework.
This chapter features a simple “Hello world” Flutter program and several embellishments. You can run the code, dissect it, change it, and have fun with it.
First Things First: Creating a Flutter Project
Listing 3-1 contains your first Flutter app.
LISTING 3-1: Ahoy, Maties!
import 'package:flutter/material.dart';main() => runApp(App0301());class App0301 extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Material( child: Text("Hello world!"), ), ); }}
Follow these steps ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access