title: Future builder Constantly Updates
body: <p>I am using a future builder to grab data from a snapshot and filter that data into another Future function that creates markers. I get the results from filtering the locations for all of the restaurants but, the function constantly updates and the data just flickers. </p>
  
  <p>Edit 2: JSON Data</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    { restaurant:[  {
              "id": 4,
              "restaurant_name": "Good Chemistry",
              "phone": "1231231234",
              "street_address": "2 Penn Plaza",
              "restaurant_logo": "https://restaurants.s3.amazonaws.com/restaurant_logo/GOODCHEM-3-web_99314.jpg",
              "restaurant_photo": "https://restaurants.s3.amazonaws.com/restaurant_photo/GOODCHEM-3-web_99314.jpg",
              "city": "NY",
              "state": "New York",
              "zip_Code": 10010,
              "lat": 40.8931283,
              "lng": -73.8205375,
              "latlng": "(40.7770112244898, -74.2110798163265)",
              "opening_hours": [
                  {
                      "day_of_week": "Tuesday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Wednesday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Thursday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Friday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Saturday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Sunday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": 7,
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  }
              ],
              "ratings": 4.1
          },
          {
              "id": 3,
              "restaurant_name": "The Farmacy",
              "phone": "1231231234",
              "street_address": "11 Penn Plaza",
              "restaurant_logo": "https://restaurants.s3.amazonaws.com/restaurant_logo/farma.jpg",
              "restaurant_photo": "https://restaurants.s3.amazonaws.com/restaurant_photo/farma.jpg",
              "city": "NY",
              "state": "New York",
              "zip_Code": 10010,
              "lat": 40.8931283,
              "lng": -73.8205375,
              "latlng": "(40.7770112244898, -74.2110798163265)",
              "opening_hours": [
                  {
                      "day_of_week": "Tuesday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Wednesday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Thursday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Friday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Saturday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Sunday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": 7,
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  }
              ],
              "ratings": 4.7
          },
          {
              "id": 2,
              "restaurant_name": "Hoboken Smokin",
              "phone": "123-123-1234",
              "street_address": "11 Penn Plaza",
              "restaurant_logo": "https://restaurants.s3.amazonaws.com/restaurant_logo/urban-restaurant-web-1024x640.jpg",
              "restaurant_photo": "https://restaurants.s3.amazonaws.com/restaurant_photo/urban-restaurant-web-1024x640.jpg",
              "city": "NY",
              "state": "New York",
              "zip_Code": 10010,
              "lat": 40.8931283,
              "lng": -73.8205375,
              "latlng": "(40.7770112244898, -74.2110798163265)",
              "opening_hours": [
                  {
                      "day_of_week": "Tuesday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Wednesday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Thursday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Friday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Saturday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Sunday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": 7,
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  }
              ],
              "ratings": 3.5
          },
          {
              "id": 1,
              "restaurant_name": "The Bakeree",
              "phone": "1231231234",
              "street_address": "433 5th Ave",
              "restaurant_logo": "https://restaurants.s3.amazonaws.com/restaurant_logo/restaurantimage.jpeg",
              "restaurant_photo": "https://restaurants.s3.amazonaws.com/restaurant_photo/restaurantimage.jpeg",
              "city": "NY",
              "state": "New York",
              "zip_Code": 10016,
              "lat": 40.7512061,
              "lng": -73.9822721,
              "latlng": "(40.7770112244898, -74.2110798163265)",
              "opening_hours": [
                  {
                      "day_of_week": "Tuesday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Wednesday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Thursday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Friday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Saturday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": "Sunday",
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  },
                  {
                      "day_of_week": 7,
                      "opening_time": "08:00:00",
                      "closing_time": "22:00:00"
                  }
              ],
              "ratings": 4.6
          }
      ]
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>EDIT 1: _setRestaurant function</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Future getRestaurants() async {
    var url = 'http://yellows-1929.herokuapp.com/api/customer/restaurant/';
  
    var response = await http.get(url);
    var responseData = json.decode(response.body);
  
    Restaurants _restaurant = Restaurants.fromJSON(responseData);
  
    return _restaurant.restaurant;
  }
  
  
  
  
  Filter Location function
  
  &lt;!-- begin snippet: js hide: false console: true babel: false --&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Future builder that gets the data and calls the function filterMarker:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Widget _buildRestaurants() {
      return Padding(
          padding: const EdgeInsets.all(8.0),
          child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: &lt;Widget&gt;[
                FutureBuilder(
                    future: _setRestaurants,
                    builder: (context, AsyncSnapshot snapshot) {
                      var restaurants = snapshot.data;
                      recRestaurants = snapshot.data;
  
                      if (snapshot.data == null) {
                        return Center(child: CircularProgressIndicator());
                      } else {
                            filterMarker(restaurants, 20);
  
                        return Column(
                          children: &lt;Widget&gt;[
                            _makeRestaurants(restaurants),
                            _buildCoupon(),
                            _buildVendors(filteredVenues)
                          ],
                        );
                      }
                    })
              ]));
    }</code></pre>
  </div>
  </div>
  </p>
  
  <p>THe filter just constantly updates and prints</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>flutter: the lat is 41.722068434324785 and the long is -74.34910777767849
  flutter: There are 1 _filteredMarkers
  flutter: There are 0 _filteredMarkers
  flutter: There are 0 _filteredMarkers
  flutter: There are 1 _filteredMarkers
  flutter: There are 1 _filteredMarkers
  flutter: There are 1 _filteredMarkers
  flutter: There are 0 _filteredMarkers
  flutter: There are 0 _filteredMarkers
  flutter: There are 1 _filteredMarkers</code></pre>
  </div>
  </div>
  </p>