Days 1-2: Dart Introduction and Development Tools

I am a developer from Indonesia
Search for a command to run...

I am a developer from Indonesia
No comments yet. Be the first to comment.
Exploring Shortcut Routes to Professionalism: Delving into Dart, Flutter, and Serverpod for Building Stunning Applications. Github repository : https://github.com/ahliweb/learning-dart
Objective: Learn if-else, loops (for, while, do-while), and switch-case. Create simple examples to understand flow control. Learn to create and call functions. 1. Flow Control 1.1 If-Else Statements: The if-else statement is used to execute cod...
Dokumen Nilai, Arah Hidup, dan Pedoman Implementasi 1. Pendahuluan Prinsip Hidup AhliWeb merupakan fondasi nilai yang menjadi arah berpikir, bersikap, mengambil keputusan, bekerja, membangun bisnis,
![[Indonesian] Prinsip Hidup AhliWeb Versi 2](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fuploads%2Fcovers%2F6608de5cd660c76b8626061d%2F8a6aa718-4fc2-493c-86ad-5f26b1dcaf99.png&w=3840&q=75)
Pendahuluan AW Non-Commercial License 1.0 adalah lisensi perangkat lunak source-available yang dirancang untuk memungkinkan akses publik terhadap source code sekaligus tetap menjaga kontrol eksklusif
![[Indonesian] Memahami Wiki AW Non-Commercial License 1.0](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fuploads%2Fcovers%2F6608de5cd660c76b8626061d%2Ff2bf3812-7079-4c4f-a6f9-fe2ba1c0aa06.png&w=3840&q=75)
Introduction The AW Non-Commercial License 1.0 is a source-available software license designed to allow public access to source code while preserving the copyright holder’s exclusive control over comm

Indonesia menghadapi tantangan besar di ruang digital, di mana jumlah pengguna media sosial telah melebihi 191,4 juta jiwa per Februari 2022, mencakup sekitar 68,9% dari populasi. Peningkatan sirkulasi konten ini, sayangnya, disertai dengan risiko ti...

🔰 RINGKASAN SINGKAT STRATEGI MARKETING HODi: HODi (Hybrid Omnichannel Distribution Initiative) adalah strategi distribusi dan pemasaran terpadu yang menggabungkan kekuatan online + offline, otomatisasi + human touch, teknologi + komunikasi personal...
Install Dart SDK and development tools (VSCode/IntelliJ).
Learn basic Dart syntax: variables, data types, operators.
Dart SDK Installation:
Download Dart SDK:
Visit the Dart SDK Download Page.
Select the appropriate SDK for your operating system (Windows, macOS, Linux).
Install Dart SDK:
Verify Installation:
Open your terminal or command prompt.
Run the command dart --version to check if Dart is installed correctly.
Development Tools Installation:
Visual Studio Code (VSCode):
Download and install Visual Studio Code.
Open VSCode and go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or pressing Ctrl+Shift+X.
Search for the Dart extension and install it.
IntelliJ IDEA:
Download and install IntelliJ IDEA.
Open IntelliJ IDEA and go to File > Settings > Plugins.
Search for the Dart plugin and install it.
Variables:
Variables in Dart can be declared using var, final, or const.
void main() {
var name = 'John'; // A variable that can be reassigned
final age = 25; // A variable that cannot be reassigned
const pi = 3.14; // A compile-time constant
print('Name: $name, Age: $age, Pi: $pi');
}
Data Types:
Dart is a strongly typed language, and it supports various data types like int, double, String, bool, List, and Map.
void main() {
int a = 10;
double b = 20.5;
String c = 'Hello';
bool d = true;
List<int> e = [1, 2, 3];
Map<String, int> f = {'one': 1, 'two': 2};
print('Int: $a, Double: $b, String: $c, Bool: $d, List: $e, Map: $f');
}
Operators:
Dart supports various operators, including arithmetic, relational, logical, and assignment operators.
void main() {
int a = 10;
int b = 20;
// Arithmetic Operators
print('Addition: ${a + b}');
print('Subtraction: ${a - b}');
print('Multiplication: ${a * b}');
print('Division: ${a / b}');
print('Modulus: ${a % b}');
// Relational Operators
print('Equal: ${a == b}');
print('Not Equal: ${a != b}');
print('Greater than: ${a > b}');
print('Less than: ${a < b}');
// Logical Operators
bool c = true;
bool d = false;
print('AND: ${c && d}');
print('OR: ${c || d}');
print('NOT: ${!c}');
// Assignment Operators
int e = 5;
e += 5; // e = e + 5
print('Assignment: $e');
}
Example 1: Basic Dart Program
void main() {
print('Hello, Dart!');
}
Explanation: This is the simplest Dart program. The main() function is the entry point of the program, and print() is used to output text to the console.
Example 2: Using Variables and Data Types
void main() {
var name = 'Alice';
int age = 30;
double height = 5.6;
bool isStudent = false;
print('Name: $name');
print('Age: $age');
print('Height: $height');
print('Is Student: $isStudent');
}
Explanation: This program demonstrates declaring variables of different data types and printing their values.
Example 3: Using Operators
void main() {
int a = 15;
int b = 4;
print('Sum: ${a + b}');
print('Difference: ${a - b}');
print('Product: ${a * b}');
print('Quotient: ${a / b}');
print('Remainder: ${a % b}');
}
Explanation: This program uses arithmetic operators to perform basic mathematical operations on two integers.
1. Dart SDK Installation:
Figure 1: Dart SDK download page.

Figure 2: Verifying Dart installation in terminal.

2. Variables and Data Types:
Figure 3: Example of declaring variables and data types in Dart.

3. Operators:
Figure 4: Example of using operators in Dart.

By following this guide, you'll have a solid understanding of the basics of Dart and be ready to move on to more advanced concepts in the following days. Happy coding!