title: Check if values are those same objects
body: <p>I'm pretty new to Dart and I got some problems with understanding what is going on under the hood. I've simple code like this:</p>
  <pre><code>void main() {
    String s1 = &quot;test1&quot;;
    StringBuffer sb = StringBuffer();
    sb.write(&quot;test&quot;);
    sb.write(&quot;1&quot;);
    String s2 = sb.toString();
    print(identical(s1, s2));
    print(s1 == s2);
    
    int a = 1;
    int b = 1;
    print(identical(a, b));
  }
  </code></pre>
  <p>result of this code is 3x true</p>
  <p>Which is little tricky for me. As I understands all variables refers to some values, and since == operator is expected to return true, I'm little confused why identical also return true. If I would use code like:</p>
  <pre><code>String s1 = &quot;test1&quot;;
  String s2 = &quot;test1&quot;;
  </code></pre>
  <p>Then I would expect that there is compiler optimization for immutable strings. But since I combine it via StringBuffer I would expect that I got two different values in memory. I suspect that identical uses == operator internally... Why I'm curious: I'm working on app which will use sets of tags. And I'm not sure If should I create some pool of strings and checks if some strings are already created and reuse it or just spawn strings and Dart has it's own string pool?</p>