使用extension on 关键字
main(List<String> args) {
String a = 'tom';
print(a.hello());
}
extension NumberParsing on String {
String hello() {
return 'hello ' + this;
}
}
dart 扩展方法
阅读 124
2022-12-08
main(List<String> args) {
String a = 'tom';
print(a.hello());
}
extension NumberParsing on String {
String hello() {
return 'hello ' + this;
}
}
相关推荐
精彩评论(0)