We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.4.2.1 Dart函数声明如果没有显式声明返回值类型时会默认当做dynamic处理,注意,函数返回值没有类型推断
》》实际我敲代码,如果没有显示声明返回值类型,是不会当做dynamic处理,都有正确的类型推断。
class Test {} main() { print(getTest1().runtimeType); print(getTest2().runtimeType); print(getTest().runtimeType); } getTest1() { return 123; } getTest2() { return "hello"; } getTest() { return new Test(); }
返回值结果如下: int String Test
The text was updated successfully, but these errors were encountered:
补充:我的dart版本是3.5.0 stable.
Sorry, something went wrong.
No branches or pull requests
1.4.2.1
Dart函数声明如果没有显式声明返回值类型时会默认当做dynamic处理,注意,函数返回值没有类型推断
》》实际我敲代码,如果没有显示声明返回值类型,是不会当做dynamic处理,都有正确的类型推断。
返回值结果如下:
int
String
Test
The text was updated successfully, but these errors were encountered: