Kotlin OkHttp3 Using 'of(Map<String, String>): Headers' 是一个错误。功能移至扩展

Kotlin OkHttp3 Using 'of(Map<String, String>): Headers' is an error. function moved to extension

下面的代码给出了错误:使用 'of(Map): Headers' 是一个错误。功能移至扩展。

val mapH = mapOf (Pair("Content-Disposition",
          "file; filename=\"$encodedFileName\""),
          Pair("Content-Transfer-Encoding",
          "binary"))

    val headers = Headers.of (mapH)

阅读了此处的文档 https://square.github.io/okhttp/upgrading_to_okhttp_4/#extension-functions,我尝试了:

      val headers = headersOf(mapH)
and also 
      val headers = mapH.toHeaders()

并得到错误:未解决的参考:headersOf 和 toHeaders。为什么?

试试这个:

import okhttp3.Headers.Companion.toHeaders