在 flutter 的 Image widget 中,我发现像 Image.asset() 和 Image.file() 这样的构造函数名称带有点 (.) 的用法。
它是什么以及如何使用?
最佳答案
Use a named constructor to implement multiple constructors for a class or to provide extra clarity:
class Point { num x, y; Point(this.x, this.y); // Named constructor Point.origin() { x = 0; y = 0; } }
关于dart - 这个带点的构造函数名称是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56267363/