Saturday, April 24, 2021

Flutter create project using CLI

 create flutter project from CLI:


flutter create app_widgets


flutter doctor --> to check for issues


lib\main.dart:

---


//main.dart
import 'package:flutter/material.dart';

void main() {
   runApp(MyApp());

}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "Hello Flutter App",
      home: new Material(
        color: Colors.deepPurple,
        child: Center(
          child: Text(
            "Hello Flutter!",
            textDirection: TextDirection.ltr,
            style: TextStyle(color: Colors.white,fontSize: 36.0),
          ),
        ),
      ),
    );
  }
}



flutter run


to hot reload, press "r"

No comments:

Post a Comment