简体   繁体   中英

In Dart / IntelliJ Idea how to make it an error when you miss a return?

In Dart / IntelliJ Idea how to make it an error (not a simple warning) when you miss a return?

If I forget to add a return, it's a simple warning, it's very easy to miss, and this makes me waste a lot of time.

warning: This function declares a return type of 'RichText', but doesn't end with a return statement.

Also, if the function has a return parameter, I don't see how it's not an error simply not returning anything (at least in Flutter).

Grab a copy of the default analysis_options.yaml from here . Put it in the top folder of your flutter project (next to pubspec.yaml ). Change line 31 to:

    missing_return: error

Beware of this issue .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM