We will now create a new app that we'll use throughout this chapter to build a fully functioning measure converter:
- From your favorite editor, create a new app. Name the new app Unit Converter.
- In the main.dart file, remove the example code and write the code given as follows:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Measures Converter',
home: Scaffold(
appBar: AppBar(
title: Text('Measures Converter'),
),
body: Center(
child: Text('Measures Converter'),
),),
);}
}
As you may have noticed, the preceding code makes use of a Stateless widget:
class MyApp extends StatelessWidget {
A Stateless widget is...