Dart Basics
Dart Basics
1. Introduction to Dart
optimized for building user interfaces, especially for mobile, web, and desktop apps using the Flutter
framework.
Dart is statically typed. You can use var, final, or const to declare variables.
Example:
3. Functions
Functions in Dart are objects and can be assigned to variables or passed as parameters.
Example:
return a + b;
4. Control Flow
Dart supports standard control flow statements like if-else, switch, for, while, and do-while loops.
Example:
print("Adult");
} else {
print("Minor");
Example:
class Person {
String name;
int age;
Person(this.name, this.age);
void introduce() {
6. Null Safety
7. Collections
Example:
8. Asynchronous Programming
Example:
print("Data fetched");