Python 可以像使用装饰器的属性一样访问方法@property
。Dart有这样的东西吗?
class Test():
@property
def example():
return "This isn't really a property"
a = new Test()
print a.example
Python 可以像使用装饰器的属性一样访问方法@property
。Dart有这样的东西吗?
class Test():
@property
def example():
return "This isn't really a property"
a = new Test()
print a.example
getter的概念看起来很相似:
class Test {
String get example {
return "This isn't really a property";
}
}
main() {
var a = new Test();
print(a.example);
}