gpt4 book ai didi

flutter - 如何在 flutter 中检索当前的类名?

转载 作者:IT老高 更新时间:2023-10-28 12:36:48 29 4
gpt4 key购买 nike

我有一个类:

class Dog {

Dog() {
print("Current classname is: ${this.className}");
}

}

似乎 this.className 是不允许的。有什么等价的吗?

最佳答案

this.runtimeType

或者只是

runtimeType

返回当前类的名称。

关于flutter - 如何在 flutter 中检索当前的类名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52764758/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com