- const MyApp({Key? key}) : super(key: key); おまじない
- constなクラスにはconstをつけるとワーニングが消える
import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp ( title: 'Flutter Demo', theme: ThemeData(primarySwatch: Colors.blue), home: Scaffold ( appBar: AppBar(title: const Text('Flutter Demo')), body: const Center(child: Text('Hello World')), floatingActionButton: FloatingActionButton(onPressed: () {}, child: const Icon(Icons.add)), ), ); } }