title: Scroll Controller is going to top after loading data from http call in flutter
body: <p>I am fetching the list from my http server .The list is fetching the data whenever the scroll controller reaches to the bottom of the screen. Loading data from http service and showing in the screen is working fine. The problem comes when loading more data the scroll controller goes to the top of the screen instead of staying on the last location its going to top and doing scrolling again to the previous scrolled data.</p>
  <p>I just want to avoid the scrollbar to go to top so the user will only scroll the latest data.</p>
  <p>//Here is my viewModel</p>
  <pre><code>import 'package:testingApp/models/property_model.dart';
  import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  import 'package:stacked/stacked.dart';
  import 'package:testingApp/helpers/debouncer.dart';
  import 'package:testingApp/helpers/toastr.dart';
  import 'package:testingApp/services/property_service.dart';
  
  class PropertyViewModel extends BaseViewModel {
    List _properties = [];
    int _offsetVal = 0;
    //String _keyword;
    bool _isResults = true;
    bool _isFiltering = false;
    String _filterCheck = 'date_up';
    String _filterPriceCheck = 'price_up';
    String _filterAreaCheck = 'area_up';
    bool loadingShimmer = true;
    bool searchFilterStatus = false;
  
    ScrollController scrollController = ScrollController();
    TextEditingController searchCtrl = new TextEditingController();
    Debouncer _debouncer = Debouncer(milliseconds: 1000);
    Property property = Property();
  
    void initialise() {
      scrollController.addListener(() {
        if (scrollController.position.pixels ==
            scrollController.position.maxScrollExtent) {
          this.incrementOffset();
          this._isFiltering = false;
          notifyListeners();
        }
      });
    }
  
    @override
    void dispose() {
      searchCtrl.dispose();
      scrollController.dispose();
      super.dispose();
    }
  
    //FETCHING THE properties FROM HTTP SERVICE
    getTheProperty(priceSliderMin, priceSliderMax, areaSliderMin, areaSliderMax,
        beds, baths, chosenCity, searchKeywords, searchStatus, searchType) async {
      if (!_isFiltering) {
        if (_isResults) {
          this.loadingShimmer = true;
          await PropertyService.getProperties(
            _offsetVal,
            priceSliderMin,
            priceSliderMax,
            areaSliderMin,
            areaSliderMax,
            beds,
            baths,
            chosenCity,
            searchKeywords,
            searchStatus,
            searchType,
          ).then((propertyJSON) {
            //MAP JSON TO property LIST
            final List properties = propertyFromJson(propertyJSON);
            if (properties.length != 0) {
              _properties.addAll(properties);
            } else {
              showToastrMessage('No more properties found.');
              _isResults = false;
              //NO MORE RESULTS
            }
          });
        } else {
          showToastrMessage('No more properties found.');
        }
      }
  
      this.loadingShimmer = false;
  
      return _properties;
    }
  
    //INCREATING TO LOAD MORE DATA USING INFINITE SCROLLING
    incrementOffset() {
      _offsetVal = property.incrementOffset(_offsetVal);
    }
  
  
    //USE TO PRINT ERRRO IN SCREEN
    Widget showError(String msg) {
      return Center(
        child: Text(msg),
      );
    }
  }
  </code></pre>
  <p>//HERE IS MY VIEW</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:line_awesome_flutter/line_awesome_flutter.dart';
  import 'package:stacked/stacked.dart';
  import 'package:testingApp/helpers/error_handling.dart';
  import 'package:testingApp/widgets/property_detail.dart';
  import 'property_viewmodel.dart';
  import 'package:shimmer/shimmer.dart';
  import 'package:testingApp/constant.dart';
  import 'package:testingApp/nav_drawer.dart';
  import 'package:testingApp/ui/views/search/search_view.dart';
      class PropertyView extends StatelessWidget {
        final double priceSliderMin;
        final double priceSliderMax;
        final double areaSliderMin;
        final double areaSliderMax;
        final String beds;
        final String baths;
        final String chosenCity;
        final String searchKeywords;
        final String searchStatus;
        final String searchType;
      
        const PropertyView(
            {Key key,
            this.priceSliderMin,
            this.priceSliderMax,
            this.areaSliderMin,
            this.areaSliderMax,
            this.beds,
            this.baths,
            this.chosenCity,
            this.searchKeywords,
            this.searchStatus,
            this.searchType})
            : super(key: key);
      
        @override
        Widget build(BuildContext context) {
          return ViewModelBuilder&lt;PropertyViewModel&gt;.reactive(
            builder: (context, model, child) =&gt; Scaffold(
              drawer: Theme(
                data: Theme.of(context).copyWith(canvasColor: plpGredientOne),
                child: NavDrawer(),
              ),
              appBar: PreferredSize(
                preferredSize: Size.fromHeight(55.0),
                child: AppBar(
                  title: Text('Properties'),
                  backgroundColor: plpGredientOne,
                  elevation: 0.0,
                ),
              ),
              body: Container(
                color: Colors.white,
                child: new Builder(builder: (BuildContext context) {
                  return Column(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: &lt;Widget&gt;[
                      SizedBox(
                        height: 1,
                      ),
                      Row(
                        children: &lt;Widget&gt;[
                          Expanded(
                            child: ElevatedButton(
                              onPressed: () {
                                model.setFilteringCheck = true;
                                model.filterByDate();
                              },
                              style: ElevatedButton.styleFrom(
                                padding: EdgeInsets.all(12.0),
                                primary: plpGredientOne,
                                onPrimary: plpGredientTwo,
                                onSurface: Colors.grey[400],
                                shape: new RoundedRectangleBorder(
                                  borderRadius: new BorderRadius.circular(0),
                                ),
                              ),
                              child: Row(
                                children: [
                                  Icon(
                                      model.filterStatus == 'date_down'
                                          ? LineAwesomeIcons.sort_amount_down
                                          : LineAwesomeIcons.sort_amount_up,
                                      color: Colors.white,
                                      size: 25.0),
                                  Text(
                                    'Date',
                                    style: TextStyle(
                                      color: Colors.white,
                                      fontSize: 14.0,
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ),
                          Expanded(
                            child: ElevatedButton(
                              onPressed: () {
                                model.setFilteringCheck = true;
                                model.filterByArea();
                              },
                              style: ElevatedButton.styleFrom(
                                padding: EdgeInsets.all(12.0),
                                primary: plpGredientOne,
                                onPrimary: plpGredientTwo,
                                onSurface: Colors.grey[400],
                                shape: new RoundedRectangleBorder(
                                  borderRadius: new BorderRadius.circular(0),
                                ),
                              ),
                              child: Row(
                                children: [
                                  Icon(
                                      model.filterAreaCheck == 'area_up'
                                          ? LineAwesomeIcons.sort_amount_up
                                          : LineAwesomeIcons.sort_amount_down,
                                      color: Colors.white,
                                      size: 25.0),
                                  Text(
                                    'Area',
                                    style: TextStyle(
                                      color: Colors.white,
                                      fontSize: 14.0,
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ),
                          Expanded(
                            child: ElevatedButton(
                              onPressed: () {
                                model.setFilteringCheck = true;
                                model.filterByPrice();
                              },
                              style: ElevatedButton.styleFrom(
                                padding: EdgeInsets.all(12.0),
                                primary: plpGredientOne,
                                onPrimary: plpGredientTwo,
                                onSurface: Colors.grey[400],
                                shape: new RoundedRectangleBorder(
                                  borderRadius: new BorderRadius.circular(0),
                                ),
                              ),
                              child: Row(
                                children: [
                                  Icon(
                                      model.filterPriceCheck == 'price_down'
                                          ? LineAwesomeIcons.sort_amount_down
                                          : LineAwesomeIcons.sort_amount_up,
                                      color: Colors.white,
                                      size: 25.0),
                                  Text(
                                    'Price',
                                    style: TextStyle(
                                      color: Colors.white,
                                      fontSize: 14.0,
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ),
                          model.searchFilterStatus
                              ? Expanded(
                                  child: ElevatedButton(
                                    onPressed: () {
                                      Navigator.push(
                                          context,
                                          MaterialPageRoute(
                                              builder: (context) =&gt; SearchView()));
                                    },
                                    style: ElevatedButton.styleFrom(
                                      padding: EdgeInsets.all(12.0),
                                      primary: plpGredientOne,
                                      onPrimary: plpGredientTwo,
                                      onSurface: Colors.grey[400],
                                      shape: new RoundedRectangleBorder(
                                        borderRadius: new BorderRadius.circular(0),
                                      ),
                                    ),
                                    child: Row(
                                      children: [
                                        Icon(LineAwesomeIcons.times,
                                            color: Colors.white, size: 25.0),
                                        Text(
                                          ' Clear',
                                          style: TextStyle(
                                            color: Colors.white,
                                            fontSize: 14.0,
                                          ),
                                        ),
                                      ],
                                    ),
                                  ),
                                )
                              : Expanded(
                                  child: ElevatedButton(
                                    onPressed: () {
                                      Navigator.push(
                                          context,
                                          MaterialPageRoute(
                                              builder: (context) =&gt; SearchView()));
                                    },
                                    style: ElevatedButton.styleFrom(
                                      padding: EdgeInsets.all(12.0),
                                      primary: plpGredientOne,
                                      onPrimary: plpGredientTwo,
                                      onSurface: Colors.grey[400],
                                      shape: new RoundedRectangleBorder(
                                        borderRadius: new BorderRadius.circular(0),
                                      ),
                                    ),
                                    child: Row(
                                      children: [
                                        Icon(LineAwesomeIcons.search,
                                            color: Colors.white, size: 25.0),
                                        Text(
                                          ' Search',
                                          style: TextStyle(
                                            color: Colors.white,
                                            fontSize: 14.0,
                                          ),
                                        ),
                                      ],
                                    ),
                                  ),
                                ),
                        ],
                      ),
                      SizedBox(
                        height: 10,
                      ),
                      Expanded(
                        child: new FutureBuilder(
                            future: model.getTheProperty(
                                priceSliderMin,
                                priceSliderMax,
                                areaSliderMin,
                                areaSliderMax,
                                beds,
                                baths,
                                chosenCity,
                                searchKeywords,
                                searchStatus,
                                searchType),
                            builder: (context, snapshot) {
                              if (snapshot.hasData &amp;&amp; model.loadingShimmer == false) {
                                List myList = snapshot.data;
                                return ListView.builder(
                                  controller: model.scrollController,
                                  itemCount: myList.isEmpty ? 0 : myList.length,
                                  itemBuilder: (context, index) {
                                    return MyPropertyDetail(
                                        propertyId: myList[index].propertyId,
                                        propertyName: myList[index].title,
                                        propertyImgUrl:
                                            myList[index].propertyThumbnailUrl,
                                        propertyCity: myList[index].propertyCity,
                                        propertyAddress:
                                            myList[index].propertyAddress,
                                        propertyBed: myList[index].propertyBeds,
                                        propertyBath: myList[index].propertyBaths,
                                        propertyArea: myList[index].propertyArea +
                                            ' ' +
                                            myList[index].propertyAreaPostfix,
                                        propertyRate:
                                            myList[index].propertyPricePrefix +
                                                ' ' +
                                                myList[index].propertyRate +
                                                ' ' +
                                                myList[index].propertyPricePostfix,
                                        propertyType: myList[index].propertyType,
                                        propertyStatus: myList[index].propertyStatus,
                                        propertyFeatured: myList[index].propertyLabel,
                                        propertyDate: myList[index].propertyDate);
                                  },
                                );
                              } else {
                                if (snapshot.hasError) {
                                  if (snapshot.error is NoInternetException) {
                                    NoInternetException noInternetException =
                                        snapshot.error as NoInternetException;
                                    return model
                                        .showError(noInternetException.message);
                                  }
                                  if (snapshot.error is NoServiceFoundException) {
                                    NoServiceFoundException noServiceFoundException =
                                        snapshot.error as NoServiceFoundException;
                                    return model
                                        .showError(noServiceFoundException.message);
                                  }
                                  if (snapshot.error is InvalidFormatException) {
                                    InvalidFormatException invalidFormatException =
                                        snapshot.error as InvalidFormatException;
                                    return model
                                        .showError(invalidFormatException.message);
                                  }
                                  UnknownException unknownException =
                                      snapshot.error as UnknownException;
                                  return model.showError(unknownException.message);
                                } else {
                                  return LoadingPost();
                                }
                              }
                            }),
                      ),
                    ],
                  );
                }),
              ),
            ),
            fireOnModelReadyOnce: true,
            disposeViewModel: true,
            onModelReady: (model) =&gt; model.initialise(),
            viewModelBuilder: () =&gt; PropertyViewModel(),
          );
        }
      }
  </code></pre>