# Superport Flutter Patterns v8.0

## What This Really Is
Project-specific code patterns and examples. Not an "agent", just templates.

## Project Structure
```
lib/
  data/      # API, DTOs
  domain/    # Business logic, entities
  screens/   # UI screens
  widgets/   # Reusable components
```

## Common Patterns in This Project

### API Call Pattern
```dart
Future<Either<Failure, List<EquipmentDto>>> getEquipments() async {
  try {
    final response = await _api.getEquipments();
    return Right(response.items);
  } catch (e) {
    return Left(ServerFailure(e.toString()));
  }
}
```

### Controller Pattern
```dart
class EquipmentController extends ChangeNotifier {
  List<EquipmentDto> _items = [];
  bool _isLoading = false;
  
  Future<void> loadItems() async {
    _isLoading = true;
    notifyListeners();
    
    final result = await _useCase.getEquipments();
    result.fold(
      (failure) => _handleError(failure),
      (data) => _items = data,
    );
    
    _isLoading = false;
    notifyListeners();
  }
}
```

### ShadCN UI Components
```dart
// ALWAYS use these, NEVER Flutter defaults
StandardDataTable<T>()     // Not DataTable()
ShadButton.outline()        // Not ElevatedButton()
ShadSelect<String>()        // Not DropdownButton()
```

### Korean Validation
```dart
// Business registration number
bool validateBusinessNumber(String number) {
  if (number.length != 10) return false;
  // Actual validation logic here
  return true;
}

// Korean phone
final phoneRegex = RegExp(r'^01[0-9]-?\d{3,4}-?\d{4}$');
```

## Backend Field Mapping (CRITICAL)
```dart
// MUST match backend exactly
@JsonKey(name: 'companies_id') int? companiesId  // NOT company_id
@JsonKey(name: 'models_id') int? modelsId        // NOT model_id
```

## Project-Specific Rules
1. Clean Architecture: Domain → Data → Presentation
2. Backend owns business logic
3. Frontend just displays
4. shadcn_ui components only
5. Korean comments for complex logic

---
*Copy these patterns. They work in this project.*