Articles → FLUTTER AND DART → Create An Application From Scratch In Flutter

Create An Application From Scratch In Flutter






Steps




  1. Import the material.dart namespace using the following code
  2. import 'package:flutter/material.dart';




  3. Create a new class and inherit it with StatelessWidget class.
  4. class MyApp extends StatelessWidget {
      Widget build(BuildContext context) {
        return MaterialApp(home: Text("Hello"));
      }
    }




  5. Finally, create a main method. Inside the main method, we are calling the class ‘MyApp’ inside runApp method.
void main() {
  runApp(MyApp());
}




Picture showing the first application created in flutter
Click to Enlarge


Complete Code


import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(home: Text("Hello"));
  }
}



Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, July 31, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250