title: Using a list of objects, how can I access the objects properties and print them?
body: <p>Short question.</p>
  
  <p>I'm trying to learn how to use objects in order to specify lists etc and access the objects properties. I just can't get it to work properly.</p>
  
  <p>So, this is what I'm trying to achieve:</p>
  
  <ol>
  <li>Create list objList;</li>
  <li>Add object into list</li>
  <li>Get specific object from list</li>
  <li>print it in console!</li>
  </ol>
  
  <p>My code:</p>
  
  <p><strong>Object class</strong></p>
  
  <pre><code>class SearchObject {
    final String barName;
    final String latitudeDbRef;
  
    SearchObject({this.barName, this.latitudeDbRef});
  }
  </code></pre>
  
  <p><strong>List declaration and object</strong></p>
  
  <pre><code>List&lt;SearchObject&gt; searchObject = new List();
  SearchObject sbo = new SearchObject();
  </code></pre>
  
  <p><strong>Add objects to list</strong></p>
  
  <pre><code>searchObject.add(SearchObject(barName: value, latitudeDbRef: "test"));
  </code></pre>
  
  <p><strong>Access and print specific object</strong></p>
  
  <pre><code>print(searchObject.getRange(index, index + 1).map((sbo) {
                      String bar = sbo.barName.toString();
                      String lat = sbo.latitudeDbRef.toString();
                      print("Barname: $bar");
                      print("latName: $lat");
                    }));
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>flutter: Barname: barname
  flutter: latName: test
  flutter: (null)   &lt;- Get rid of this?
  </code></pre>
  
  <p><em>Note:</em>
  I already tried with removing the print()-statement around my searchObject.getRange() code, and by doing that it doesn't print anything at all. </p>
  
  <p>Any suggestions? </p>
  
  <p>Best regards!</p>