title: Find and Replace Strings in Dart
body: <p>I'm using flutter for this app and I'm having trouble with the app's logic. Any help is much appreciated.</p>
  
  <p>App goal: Decode(replace) all input abbreviation to words by:
            -User inputs text via text box
            -App looks for any abbreviations(several) and replaces the abbreviation only with text.</p>
  
  <p>I was able to do it will a few abbreviation but with my case all abbreviation should be in the input text or it wouldn't work or the second index wont work.
  I tried several ways which didn't work, I'm using 2 list for the abv and corresponding text.</p>
  
  <p>Here is the code.</p>
  
  <pre><code>List&lt;String&gt; coded = ["GM", "HOT", "YAH"]; //ABV list
  List&lt;String&gt; decoded = ["Gmail", "Hotmail", "Yahoo"]; //corresponding list 
  Map&lt;String, String&gt; map = new Map.fromIterables(coded, decoded);
  
  String txt = "HOT was the best until GM took over"; //input text
  
  void main() {
    if ((txt.contains(coded[0]))) { //GM
      String result = txt.replaceAll(coded[0], decoded[0]); //Replace with Gmail
  
      print(result);
    }
    else if ((txt.contains(coded[0])) &amp;&amp; (txt.contains(coded[1]))) {
      String result = (txt.replaceAll(coded[0], decoded[0]));
      (txt.replaceAll(coded[1], decoded[1]));
  
      print(result);
    }
    else if ((txt.contains(coded[0])) &amp;&amp; (txt.contains(coded[1])) &amp;&amp; (txt.contains(coded[2]))) {
      String result = txt.replaceAll(coded[0], decoded[0]);
      txt.replaceAll(coded[1], decoded[1]);
      txt.replaceAll(coded[2], decoded[2]);
  
      print(result);
    }
    else {
      print(txt);
    }
  } 
  </code></pre>