Here’s a basic “Hello, World!” app in Flutter:
- Create a new Flutter project in your IDE.
- Open the
main.dart
file. - Replace the existing code with the following:
import ‘package:flutter/material.dart’;
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: ‘Hello, World!’,
home: Scaffold(
appBar: AppBar(
title: Text(‘Hello, World!’),
),
body: Center(
child: Text(‘Hello, World!’),
),
),
);
}
}
- Save the file and run the app.
This will create a simple app with a title that says “Hello, World!” and a centered message that also says “Hello, World!”. You can customize the title and message to say whatever you want.
Facebook Comments Box