title: Dart/ Flutter reading and writing list of lists - Why am I unable to access objects in my list of lists with an index number?
body: <p>I am new to dart, and I am working on my first project. I am currently working on the storage aspect of my project, and I have encountered difficulties when trying to access files that have been written in .txt format. I am trying save a file in .txt format which contains a list of lists. I write to file using the .writeAsString() method to convert my list to a string so that it can be saved as a .txt file. I use the following piece of code to read the file and convert it back to a list of lists.</p>
  
  <pre><code>    widget.storage.readData().then((String value) {
      setState(() {
      _state = value;
      final regExp = new RegExp(r'(?:\[)?(\[[^\]]*?\])(?:\])?');
  
      List&lt;List&lt;String&gt;&gt; result = regExp
          .allMatches(_state)
          .map((m) =&gt; m.group(1))
          .map((String item) =&gt; item.replaceAll(new RegExp(r'[\[\],]'), ''))
          .map((m) =&gt; [m])
          .toList();
  
      gamesList = result;       
  </code></pre>
  
  <p>When I print the value of gamesList I am given the following:</p>
  
  <pre><code>    [[75.00% 75.00% No shots 75.00% No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots 75.00% 75.00% No shots 75.00% No shots No shots No shots No shots No shots], [100.00% No shots 100.00% No shots No shots No shots 100.00% No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots No shots 100.00% No shots 100.00% No shots No shots No shots 100.00% No shots No shots]]
  </code></pre>
  
  <p>While this list appears to hold the same values which I had originally saved, I am not able to access any of these values with an index number. For example, I would like to be able to say:</p>
  
  <pre><code>    print(gamesList[0][1]);
  </code></pre>
  
  <p>Theoretically this should return the object '75.00%' (refer to the output from the print statement above). I have noticed that there are commas missing from within the list and perhaps this is why my code won't execute the way I would like it to.</p>