Architecture contract (ARCH8204)
هذا المحتوى غير متوفر بلغتك بعد.
Key kotlin.architecture.contract · Severity error · Category architecture
Flags an import against the layer direction, a feature’s boundary or the project’s own architecture rules: a feature under feature/, features/ or slices/ importing another feature’s behaviour (a class with functions, an object, a function - its data classes, enums and interfaces are allowed); data, service or domain code importing the presentation layer; the domain importing the data layer in a module whose data layer depends on its domain (where use cases call the data layer, as Android’s architecture guide has it, that is the design); or any import a rule in Project settings > Scanning forbids. A dependency between two Gradle modules is declared in the build and is checked only against the presentation rule and the project’s rules. Read from package names, not class names.
Incorrect
Section titled “Incorrect”package app.data.repository
import app.ui.visit.VisitUiState
class VisitRepositoryImpl { fun load(): VisitUiState = TODO() }Correct
Section titled “Correct”package app.data.repository
import app.domain.model.Visit
class VisitRepositoryImpl { fun load(): Visit = TODO() } // the UI maps Visit to its own state