title: How to replace spaces middle of string in Dart?
body: <p>I have string as shown below. In dart trim() its removes the whitespace end of the string. My question is: How to <strong>replace spaces middle of string</strong> in Dart? </p>
  
  <pre><code>Example-1:
  
   - Original: String _myText = "Netflix.com.          Amsterdam";
   - Expected Text: "Netflix.com. Amsterdam"
  
  
  Example-2:
  
   - Original: String _myText = "The dog has a    long      tail.  ";
   - Expected Text: "The dog has a long tail."
  </code></pre>