with reference to the Flutter tutorial, I encountered an underscore, _
.
I know that in Java, _
is used as a naming convention for a private variable.
_
really be private (inaccessible by other classes) or is it just a naming convention?class RandomWordsState extends State<RandomWords> {
final List<WordPair> _suggestions = <WordPair>[];
final Set<WordPair> _saved = new Set<WordPair>();
final TextStyle _biggerFont = const TextStyle(fontSize: 18.0);
...
}
_
make the Widget private too? In this case, wouldn't the main class be unable to assess the Widget?Widget _buildRow(WordPair pair) {
final bool alreadySaved = _saved.contains(pair); // Add this line.
...
}