22
loading...
This website collects cookies to deliver better user experience
lib/main.dart
file.import 'package:flutter/material.dart';
main
function. This is the case for Dart files, so also for flutter applications.void main() {
print('Hello World 👋');
}
Hello World 👋
in the console.runApp
function inside this main function.runApp
function that shows our Hello World.Center
widget that comes with Flutter. Inside this widget, we can pass a child, in our case, a Text widget containing our text.void main() {
runApp(
Center(
child: Text(
'Hello World 👋',
textDirection: TextDirection.ltr,
),
),
);
}
flutter run
, we should see our very first Flutter application.void main() async {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: MyApp(),
),
),
);
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Text(
'Hello World 👋',
textDirection: TextDirection.ltr,
),
);
}
}
22