Writing your first app in Flutter.
Flutter SDK is Google’s UI toolkit for crafting beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.
Get the Flutter SDK
To install Flutter on your machine, follow these steps.
Update your path
Add Flutter to the PATH.
Set up an Editor
Create and run a simple Flutter app
Create a new Flutter app by running the following from the command line or terminal:
flutter create helloworld_app
A helloworld_app
directory is created, containing Flutter’s starter app.
Navigate to this directory:
cd helloworld_app
To launch the app in the Simulator/Emulator, ensure that it is running and enter:
flutter run
Write your first ‘Hello World!’ App in Flutter
Replace the default code with the below code to create ‘Hello World!’ App.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('My First App'),
),
body: Center(
child: Container(
child: Text('Hello World!'),
),
),
);
}
}
We’ve created our first Flutter application and we have it running on an emulator. 🙌
Play around with Flutter using this example application.
For more information, view Flutter documentation here.