title: What is the use of private instance variables?
body: <p>Im studying dart and have this example code here that uses private instance variables:</p>
  <pre><code>class User {
  String _first;
  String _last;
    
  String getFullName() {
  return &quot;$_first $_last&quot;;
  }
  }
  
  main() {
  User user = User();
  user._first = &quot;Bob&quot;;
  user._last = &quot;Smith&quot;;
  var fullName = user.getFullName();
  print(fullName);
  }
  </code></pre>
  <p>The code seems to work just the same with or without underscores for the variables, so I'm really struggling to understand the true purpose of this and cant think of a real world example of when a protected variable could come in handy. Protected against what exactly since everyone is free to go into your code and tweak its implementation. Same goes for private methods. Hope someone can help me understand</p>