Minimal Flutter App

Minimal Flutter app is the simplest possible app that calls the runApp( ) function with a widget.

import 'package:flutter/material.dart';

void main() {
  runApp(
    const Center(
      child: Text(
        "Minimal Flutter App.",
        textDirection: TextDirection.ltr,
      ),
    ),
  );
}

In the main function, we are calling runApp( ) function where we are passing two widgets directly irrespective of Stateless or Stateful behavior. We have wrapped the Text( ) widget in Center Widget. In other words, the Center( ) widget has only one child that is a Text( ) widget. This widget takes up the whole screen and we need to provide the text direction as we are not using MaterialApp() widget at the moment.
Tip: Remember everything in Flutter is a widget.

Output

Minimal Flutter App – Output

Comments

comments

no responses for Minimal Flutter App

    Leave a Reply

    Your email address will not be published. Required fields are marked *