Ghi chú / Chú thích (Comment)
🎯 Mục tiêu: Sử dụng comments và documentation annotations trong Dart.
💡 Các loại Comments
Phần tiêu đề “💡 Các loại Comments”// Single-line comment
/* Multi-line comment*/
/// Documentation comment (for dartdoc)/// Supports **Markdown**📝 Documentation Comments
Phần tiêu đề “📝 Documentation Comments”/// Calculates the sum of two numbers.////// Returns the sum of [a] and [b].////// Example:/// ```dart/// var result = add(2, 3); // 5/// ```int add(int a, int b) => a + b;
/// A user in the system.////// Use [User.fromJson] to create from JSON.class User { /// The user's display name. final String name;
/// Creates a new user with [name]. User(this.name);}🔧 TODO Comments
Phần tiêu đề “🔧 TODO Comments”// TODO: Implement error handling// FIXME: Memory leak issue// HACK: Temporary workaround✅ Checklist
Phần tiêu đề “✅ Checklist”- Dùng
//cho single-line - Dùng
///cho documentation - Viết doc comments cho public APIs
Tiếp theo: Kiểu dữ liệu Số