fun addNote()

in AppSearchSample/app/src/main/java/com/android/example/appsearchsample/model/NoteViewModel.kt [56:67]


  fun addNote(text: String) {
    val id = UUID.randomUUID().toString()
    val note = Note(id = id, text = text)
    viewModelScope.launch {
      val result = noteAppSearchManager.addNote(note)
      if (!result.isSuccess) {
        _errorMessageLiveData.postValue("Failed to add note with id: $id and text: $text")
      }

      queryNotes()
    }
  }