Articles → FLUTTER AND DART → Create An Application From Scratch In Flutter
Create An Application From Scratch In Flutter
Steps
- Import the material.dart namespace using the following code
import 'package:flutter/material.dart';
- Create a new class and inherit it with StatelessWidget class.
class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(home: Text("Hello"));
}
}
- Finally, create a main method. Inside the main method, we are calling the class ‘MyApp’ inside runApp method.
void main() {
runApp(MyApp());
}
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"));
}
}