Flutter를 위한 Dart 기초
Flutter에 필수적인 변수, 데이터 형식, 제어 흐름, 함수 및 객체 지향 개념을 다루며 Dart 프로그래밍의 기초를 익힙니다.
Flutter를 위한 Dart 기초은(는) CoddyKit의 무료 Flutter Mobile Development 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Flutter Mobile Development 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Flutter Mobile Development 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Welcome to Dart!
Before building apps, let’s learn Dart — Flutter’s language. It’s client-optimized and quick to pick up if you know Java or JavaScript.
Storing Data: Variables & Types
Variables store data. Declare them with var for inferred types, or be explicit: int, double, String, bool.
Variables in Action
Here’s declaring different variable types. Note Dart’s null safety: a variable can’t be null unless you opt in with ?.
void main() {
var name = "Alice"; // Type inferred as String
int age = 30;
double height = 1.75;
bool isStudent = true;
String? middleName; // Can be null
print("Name: $name");
print("Age: $age");
print("Student: $isStudent");
}Grouping Data: Lists
A Dart List is an ordered, zero-indexed collection — like an array. Declare a typed one like List<String> and grab items by position.
void main() {
List<String> fruits = ['Apple', 'Banana'];
print('Initial fruits: $fruits');
fruits.add('Orange'); // Add an item
print('After adding: $fruits');
print('First fruit: ${fruits[0]}');
}Making Decisions: If/Else
Control flow lets your code decide. if runs when a condition is true; chain else if and else for the rest.
void main() {
int temperature = 25;
if (temperature > 30) {
print('It\'s very hot!');
} else if (temperature > 20) {
print('It\'s warm.');
} else {
print('It\'s cool.');
}
}Repeating Actions: Loops
Loops repeat a block. A for loop is perfect for iterating a list or running a task a fixed number of times.
void main() {
List<String> colors = ['Red', 'Green', 'Blue'];
for (String color in colors) {
print('Color: $color');
}
for (int i = 0; i < 3; i++) {
print('Count: $i');
}
}Functions: Reusable Code
Functions are reusable blocks that do one task. They take parameters as input and can return a value as output.
Defining & Calling Functions
This shows two functions: greet takes a name, add returns an int. void means a function returns nothing.
void greet(String name) {
print('Hello, $name!');
}
int add(int a, int b) {
return a + b;
}
void main() {
greet('Coddy');
int sum = add(10, 5);
print('Sum: $sum');
}Basic Classes & Objects
Dart is object-oriented: a class is a blueprint for objects. Objects bundle properties (data) and methods (behavior) to keep code organized.
class Car {
String brand; // Property
int year; // Property
Car(this.brand, this.year); // Constructor
void displayInfo() { // Method
print('$brand from $year');
}
}
void main() {
var myCar = Car('Toyota', 2020); // Create an object
myCar.displayInfo(); // Call a method
var otherCar = Car('Honda', 2022);
otherCar.displayInfo();
}Dart Fundamentals Check
Which of the following Dart code snippets are valid variable declarations or initializations?
Recap: Dart Essentials
Nice work! You’ve got Dart’s core building blocks — variables, lists, control flow, loops, functions, and classes. This is the foundation for every Flutter app.
자주 묻는 질문
“Flutter를 위한 Dart 기초” 강의는 무료인가요?
네 — “Flutter를 위한 Dart 기초” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Flutter Mobile Development 강의 전체를 잠금 해제할 수 있습니다. Flutter Mobile Development 강의에는 총 4개의 강의가 포함되어 있습니다.
“Flutter를 위한 Dart 기초”에서 뭘 배우나요?
Flutter에 필수적인 변수, 데이터 형식, 제어 흐름, 함수 및 객체 지향 개념을 다루며 Dart 프로그래밍의 기초를 익힙니다. 브라우저에서 직접 실행하는 실습 코드로 Flutter Mobile Development을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Flutter Mobile Development을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Flutter Mobile Development은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.
“Flutter를 위한 Dart 기초” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Flutter Mobile Development 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Flutter Mobile Development 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- Flutter 생태계 및 설정
- Flutter를 위한 Dart 기초
- 첫 Flutter 앱 만들기
- Future와 async/await를 활용한 비동기 프로그래밍