CodeBlanks Logo Icon CodeBlanks

What is Flutter?

Learn that Flutter is a cross-platform UI toolkit made by Google.

What is Flutter?

Flutter is an open-source UI toolkit developed by Google. With a single codebase you build apps for iOS, Android, web and desktop. The UI is built by nesting reusable blocks called widgets.

import 'package:flutter/material.dart';

void main() {
  runApp(Center(child: Text('Hello Flutter')));
}

Widgets

In Flutter, everything on screen is a widget: buttons, text, alignment, even the app itself. Widgets nest to form a tree. StatelessWidget is for static UI, StatefulWidget for UI that changes with user interaction.

Center(
  child: Text('Counter: 0'),
)

Practice Your first Flutter app

Inside main, first print a message with print('Flutter çalışıyor'), then run a Text('Merhaba') widget wrapped in a Center widget using runApp.

Starter code

main.dart
import 'package:flutter/material.dart';

void main() {
  // önce print ile mesaj yazdır

  // sonra runApp ile Text widget'ını çalıştır

}

Sample solution

main.dart
import 'package:flutter/material.dart';

void main() {
  print('Flutter çalışıyor');
  runApp(Center(child: Text('Merhaba')));
}

Expected output

Flutter çalışıyor

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What is Flutter built for?

  • To write only Android apps
  • To publish server-side web services
  • To provide a database management system
  • Build UIs for multiple platforms from a single codebase Correct answer

Explanation: Flutter is a UI toolkit; it produces mobile, web and desktop UIs from one codebase.

2 Run the app

Question
import 'package:flutter/material.dart';

void main() {
  ____(Center(child: Text('Selam')));
}
Answer
import 'package:flutter/material.dart';

void main() {
  runApp(Center(child: Text('Selam')));
}

Explanation: runApp is the root function that attaches a Flutter app to the screen.

3 Flutter concepts

Term Meaning
Google Company that develops Flutter
cross-platform Single code, multiple platforms
widget Building block of UI
Dart Language used by Flutter

All lessons in Beginner