Interfaces & Errors

A contract for capabilities

An interface is a list of requirements β€” "any type that implements me must provide these properties and functions." It says nothing about how. It's a contract, not an implementation.

A type implements an interface by listing it after a colon (the same spot a class lists its superclass) and supplying whatever the contract demands. PawWalk's repositories are plain Kotlin objects (singletons) rather than interface implementations for now β€” but the pattern matters everywhere in Android: ViewModels expose StateFlow, screens expose Composable β€” all built on "promise to provide X, and callers can rely on it."

The simplest real example in the app: WalkerRepository promises fetchWalkers(), myProfile(), and updateProfile() β€” the ViewModel above never needs to know how those hit the network, only that they exist.