Language/Dart

[Style] no_leading_underscores_for_local_identifiers

paran21 2022. 8. 19. 17:01

다트 공식홈페이지에서 연습문제를 풀다가 no_leading_underscores_for_local_identifiers 를 알게되었다.

(에디터에서 바로바로 경고창이 떠서 놀랐다!)

 

https://dart-lang.github.io/linter/lints/no_leading_underscores_for_local_identifiers.html

 

no_leading_underscores_for_local_identifiers

no_leading_underscores_for_local_identifiers Group: style Maturity: stable View all Lint Rules Using the Linter DON’T use a leading underscore for identifiers that aren't private. Dart uses a leading underscore in an identifier to mark members and top-le

dart-lang.github.io

 

다트에서 _는 private을 의미하기 때문에 해당되지 않는 경우(예를 들면 메서드의 맴버변수!!!)에서는 _를 사용하지 말라는 의미이다.

 

아무 생각없이 _를 메서드 안에서도 다 사용했었는데 앞으로는 올바른 위치에만 쓰도록 해야겠다!