title: How to wait for retrofit.getData() complete Kotlin Coroutines
body: <p>I'm getting data from an API and I need to wait until job is finished. Because of MutableLiveData.
  When it's working response.isSusccesful=false then it's changing into true. How do I wait until retrofit.getData() is finished. I tried runblocking but it's not appropriate method. I tried async{} and await() but I didnt make it too.</p>
  <pre><code>fun loadData():ArrayList&lt;CryptoData&gt; {
  
      val retrofit = Retrofit.Builder()
          .baseUrl(BASE_URL)
          .addConverterFactory(GsonConverterFactory.create())
          .build()
          .create(CryptoAPI::class.java)
  
      job = viewModelScope.launch {
          withContext(Dispatchers.IO){
              val response = retrofit.getData()
  
              withContext(Dispatchers.Main){
  
                  if (response.isSuccessful){
                      response.body()?.let {
                          cryptoDatas = ArrayList(it)
                          currency.value = cryptoDatas
                          progressBarStatus.value = false
                          println(response.isSuccessful)
  
                      }
                  }
                  else{
                      println(response.isSuccessful)
                  }
              }
          }
      }
  
      return cryptoDatas
  }
  </code></pre>