- Add class
class RandomWordsState extends State<RandomWords> {
// TODO Add build method
}
- Add class
class RandomWords extends StatefulWidget {
@override
RandomWordsState createState() => RandomWordsState();
}
- Change class RandomWrodsState
class RandomWordsState extends State<RandomWords> {
@override
Widget build(BuildContext context) {
final WordPair wordPair = WordPair.random();
return Text(wordPair.asPascalCase);
}
}
- Change class MyApp
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final WordPair wordPair = WordPair.random(); // Delete this line.
return MaterialApp(
title: 'Welcome to Flutter',
home: Scaffold(
appBar: AppBar(
title: Text('Welcome to Flutter'),
),
body: Center(
//child: Text(wordPair.asPascalCase), // Change this line to...
child: RandomWords(), // ... this line.
),
),
);
}
}