2
Python有可能使用裝飾器@property
來訪問某個方法。 Dart有這樣的事嗎?Python @property在Dart中相當於什麼?
class Test():
@property
def example():
return "This isn't really a property"
a = new Test()
print a.example
Python有可能使用裝飾器@property
來訪問某個方法。 Dart有這樣的事嗎?Python @property在Dart中相當於什麼?
class Test():
@property
def example():
return "This isn't really a property"
a = new Test()
print a.example
的getters概念類似於:
class Test {
String get example {
return "This isn't really a property";
}
}
main() {
var a = new Test();
print(a.example);
}