#Kotlin Conventions
#Coroutines & Concurrency
- Use
suspend functions for all database and I/O operations
- Use
Flow (not LiveData) for observable data streams from repositories
- Collect Flows using
lifecycleScope or repeatOnLifecycle in UI layer
- Never use
GlobalScope or runBlocking in production code
- Use
withContext(Dispatchers.IO) for blocking I/O inside suspend functions
#General
- Prefer
data class for DTOs and domain models
- Use sealed classes/interfaces for representing finite state sets
- Prefer extension functions over utility classes
- Null safety: avoid
!! — use ?.let, ?:, or require non-null at boundaries