[英]How to call a top level function that has the same name as variable in Dart?
Simplified code example: 简化的代码示例:
int value() => 1;
main() {
int value = value(); // Error here: 'value' isn't a function
}
Is there a way to specify that I want to call a function? 有没有一种方法可以指定我要调用的函数?
If no, why is it impossible? 如果没有,为什么不可能呢?
You can use an import prefix 您可以使用导入前缀
import 'this_file.dart' as foo;
int value() => 1;
main() {
int value = foo.value(); // Error here: 'value' isn't a function
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.