Skip to main content

Command Palette

Search for a command to run...

void runApp(Widget app) / StatelessWidget

Published
•1 min read•View as Markdown
T

Software developer in South Korea

We can think of widgets as Lego blocks.

Official widgets / Community widgets

There are official widgets such as animation and input. There are also widgets created by the community.

Creating a widget is, after all, creating a class.

import 'package:flutter/material.dart';

void main() {
  runApp(App());
}

class App extends StatelessWidget{

}

StatelessWidget

root widget

build()

import 'package:flutter/material.dart';

void main() {
  runApp(App());
}

class App extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
           home:Scaffold(
            body: Text('Hello world!')),

        ); 
  }
}

What we need to do here is to return a widget called MaterialApp(Google) or a widget called CupertinoApp(Apple).