如何在Dart 2中运行Pub.build()

时间:2018-10-04 01:25:31

标签: dart dart-pub dart-webui

在Dart 1.x中,有一个命令可以触发,例如来自grinder.dart。但是此行不再起作用:

private fun nameExists(userId: String, colName: String): Boolean{
    val nameExists = booleanArrayOf(false)
    val docRefA = fbDb!!.document("users/X9ogJzjJyOgGBV0kmzk7brcQXhz1/finalGrades/col3")

    val docRefB = fbDb!!.collection("users")
            .document(userId)
            .collection("finalGrades")
            .document(colName)


    docRefA.get().addOnCompleteListener { task ->
        if (task.isSuccessful) {
            val document = task.result
            if (document.exists()) {
                nameExists[0] = true
            }else{
                Log.d(TAG, "no such document")
            }
        } else {
            Log.d(TAG, "get failed with ", task.exception)
        }
    }
    return nameExists[0]
}

如何替换它并从Dart代码运行Web应用程序的构建命令?

2 个答案:

答案 0 :(得分:2)

Dart 2不再支持

pub build

您需要运行pub run build_runner build

请参见https://webdev.dartlang.org/dart-2

不过,我不确定是否有适用于Grinder的新API。

答案 1 :(得分:0)

我通过直接调用webdev build修复了它

相关问题