使用extension on 关键字
main(List<String> args) {
String a = 'tom';
print(a.hello());
}
extension NumberParsing on String {
String hello() {
return 'hello ' + this;
}
}
微信扫一扫
main(List<String> args) {
String a = 'tom';
print(a.hello());
}
extension NumberParsing on String {
String hello() {
return 'hello ' + this;
}
}
相关推荐