Thuta Learning
Flutter
BasicMobile Developmentအခြေခံ

Hello World App

Flutterသင်ခန်းစာ 520 မိနစ်

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Hello World App ရဲ့ widget, state နဲ့ lifecycle behavior ကိုရှင်းပြနိုင်ရန်
  • Responsive, failure နဲ့ interaction cases စမ်းနိုင်ရန်
  • Accessible, testable, performant Flutter code ရေးနိုင်ရန်

ရိုးရိုးလေး ရှင်းပြမယ်

Hello World App ကို ရိုးရိုးလေးနားလည်မယ်

Hello World app က Flutter project တစ်ခုရဲ့ အခြေခံ skeleton ကိုမြင်ရတဲ့နေရာပါ။ main(), runApp(), StatelessWidget, build(), MaterialApp, Scaffold, Center, Text — ဒီအပိုင်းတွေကိုနားလည်ရင် Flutter page တစ်ခုရဲ့အရိုးစုကိုဖတ်တတ်လာပါပြီ။

Problem → Why → Solution

ပြဿနာ — ဘာကြောင့် ဒီ concept လိုတာလဲ

build() method ထဲမှာ widget return မပြန်ပေးရင် app render မဖြစ်ပါ။ Dart analyzer က error ပြပါလိမ့်မယ်။

ဖြစ်လေ့ရှိတဲ့အမှား

Screen တစ်မျိုးတွင် sample output မှန်ရုံဖြင့် rebuild, overflow, accessibility, async နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။

Core Concept — အလုပ်လုပ်ပုံကိုနားလည်မယ်

Hello World App ကို Flutter 3.47, Dart 3.13, declarative UI, sound null safety နဲ့ cross-platform lifecycle ဆက်နွယ်မှုနဲ့နားလည်ပါ။ flutter analyze နဲ့ DevTools feedback ကို design signal အဖြစ်ယူပါ။

Mental Model
  1. Input + state
  2. Widget build + layout
  3. Rendered Flutter UI

Hello World App ရဲ့ widget, state နဲ့ lifecycle behavior ကိုရှင်းပြနိုင်ရန်

အဓိက Syntax / Pattern

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

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Center(
          child: Text('Hello, World!'),
        ),
      ),
    );
  }
}

Hello World App ကို Flutter 3.47, Dart 3.13, declarative UI, sound null safety နဲ့ cross-platform lifecycle ဆက်နွယ်မှုနဲ့နားလည်ပါ။ flutter analyze နဲ့ DevTools feedback ကို design signal အဖြစ်ယူပါ။

Code ကို အဆင့်လိုက်ဖတ်မယ်

  1. Input + stateimport 'package:flutter/material.dart';

    Hello World app က Flutter project တစ်ခုရဲ့ အခြေခံ skeleton ကိုမြင်ရတဲ့နေရာပါ။ main(), runApp(), StatelessWidget, build(), MaterialApp, Scaffold, Center, Text — ဒီအပိုင်းတွေကိုနားလည်ရင် Flutter page တစ်ခုရဲ့အရိုးစုကိုဖတ်တတ်လာပါပြီ။

  2. Widget build + layouthome: Scaffold(

    Hello World App ကို Flutter 3.47, Dart 3.13, declarative UI, sound null safety နဲ့ cross-platform lifecycle ဆက်နွယ်မှုနဲ့နားလည်ပါ။ flutter analyze နဲ့ DevTools feedback ကို design signal အဖြစ်ယူပါ။

  3. Rendered Flutter UI}

    Hello World App example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။

Execution Flow
  1. Input + state
  2. Widget build + layout
  3. Rendered Flutter UI

Success

Hello World App ရဲ့ widget, state နဲ့ lifecycle behavior ကိုရှင်းပြနိုင်ရန်

Failure

build() method ထဲမှာ widget return မပြန်ပေးရင် app render မဖြစ်ပါ။ Dart analyzer က error ပြပါလိမ့်မယ်။

Hello World app က Flutter project တစ်ခုရဲ့ အခြေခံ skeleton ကိုမြင်ရတဲ့နေရာပါ။ main(), runApp(), StatelessWidget, build(), MaterialApp, Scaffold, Center, Text — ဒီအပိုင်းတွေကိုနားလည်ရင် Flutter page တစ်ခုရဲ့အရိုးစုကိုဖတ်တတ်လာပါပြီ။

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

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Center(
          child: Text('Hello, World!'),
        ),
      ),
    );
  }
}
You should see
Emulator သို့မဟုတ် browser preview မှာ Hello, World! စာသားကို screen အလယ်မှာမြင်ရပါမယ်။

နောက်တစ်ဆင့်

နောက် lesson မှာ Flutter ရဲ့ အသက်ဖြစ်တဲ့ Widget concept ကိုသေချာဖောက်ကြည့်ပါ။

Real-world usage

လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ

Hello World App example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။

Mini challenge

ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ

Hello World App example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။

  • Example ကို copy မလုပ်ဘဲ ပြန်ရေးပါ
  • Normal input နဲ့ edge case စမ်းပါ
  • Run မလုပ်မီ compiler/output result ကိုခန့်မှန်းပါ
dart
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Center(
          child: Text('Hello, World!'),
        ),
      ),
    );
  }
}

ရလဒ်: Hello World App ရဲ့ widget, state နဲ့ lifecycle behavior ကိုရှင်းပြနိုင်ရန်

အရိပ်အမြွက် ကြည့်ရန်

Hello World App example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။

Quick Quiz 1 / 3

Hello World App ရဲ့ အဓိကသဘောတရားက ဘာလဲ။

Quick Quiz 2 / 3

ဘယ်အမှားကို အရင်ဆုံးရှောင်သင့်လဲ။

Quick Quiz 3 / 3

Real project မှာ ဘယ်လိုအသုံးချသင့်လဲ။

ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ

  • Input + state → Widget build + layout → Rendered Flutter UI
  • Hello World App ကို Flutter 3.47, Dart 3.13, declarative UI, sound null safety နဲ့ cross-platform lifecycle ဆက်နွယ်မှုနဲ့နားလည်ပါ။ flutter analyze နဲ့ DevTools feedback ကို design signal အဖြစ်ယူပါ။
  • build() method ထဲမှာ widget return မပြန်ပေးရင် app render မဖြစ်ပါ။ Dart analyzer က error ပြပါလိမ့်မယ်။
  • Hello World App example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။

Flutter stable release notes — Flutter

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • build() method ထဲမှာ widget return မပြန်ပေးရင် app render မဖြစ်ပါ။ Dart analyzer က error ပြပါလိမ့်မယ်။
  • Screen တစ်မျိုးတွင် sample output မှန်ရုံဖြင့် rebuild, overflow, accessibility, async နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။
  • build() ထဲ expensive work လုပ်ခြင်း၊ controller/subscription မပိတ်ခြင်း သို့ setState ကိုကျယ်သော subtree ပေါ်ခေါ်ခြင်း။

လက်တွေ့လေ့ကျင့်ခန်း

Hello World App example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။

အလုပ်ဖြစ်ကြောင်း ဒီလိုသိမယ်: Emulator သို့မဟုတ် browser preview မှာ Hello, World! စာသားကို screen အလယ်မှာမြင်ရပါမယ်။

နောက်ဆုံးပြင်ဆင်ရက်

Progress ကို ဤ browser (ဤစက်) တွင်သာ သိမ်းထားပါသည်။ အခြားစက်များနှင့် sync မလုပ်ပါ။

ဤသင်ခန်းစာတွင် အမှားတွေ့ပါက အကြောင်းကြားရန်သင့် email app ကို ဤသင်ခန်းစာလိပ်စာ ဖြည့်ပြီးသားဖြင့် ဖွင့်ပေးပါမည် — သင်ကိုယ်တိုင် ပို့မှသာ ပို့မည်ဖြစ်သည်။

Hello World App | Thuta Learning