7K12 blog

猫でも分かるアルゴリズム解説

web31 テキスト表示

  • 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)),
      ),
    );
  }
}