Challenge 1: Entity, DAO, and Database — Solution @Entity(tableName = "notes") data class Note( @PrimaryKey(autoGenerate = true) val id: Int = 0, val title: String, val content: String ) @Dao interface NoteDao { @Query("SELECT * FROM notes ORDER BY id DESC") fun getAllNotes(): Flow> @Insert suspend fun insert(note: Note) } @Database(entities = [Note::class], version = 1) abstract class AppDatabase : RoomDatabase() { abstract fun noteDao(): NoteDao companion object { @Volatile private var INSTANCE: AppDatabase? = null fun getDatabase(context: Context): AppDatabase { return INSTANCE ?: synchronized(this) { Room.databaseBuilder(context, AppDatabase::class.java, "app_database") .build() .also { INSTANCE = it } } } } } Notes: - Note follows the same @Entity/@PrimaryKey(autoGenerate = true) shape as the chapter's Task example — id = 0 is a placeholder value used before Room assigns a real auto-generated ID on insert. - getAllNotes() returns Flow>, not a plain List — this is what makes it "live": any successful insert() call automatically causes this Flow to emit a new, updated list to every collector, without needing to be called again manually. - AppDatabase.getDatabase(context) is the standard entry point used to obtain the singleton database instance from anywhere in the app (most often from inside a ViewModel factory, covered in Challenge 2).