title: Flutter pull down to refresh seems to work but it does not refresh
body: <p>I am a beginner in Flutter and I'm struggling with this problem for quite some time now.</p>
  <p>I have made a Flutter app which fetches posts from a wordpress website. Everything works fine, except the pull to refresh. It seems to work (at least the indicator is working), but it doesn't update in the background and I have no clue where the problem could be.</p>
  <p>Please take a look to my my posts_list.dart file:</p>
  <pre><code>import 'package:wordpress_flutter/widgets/refresh_widget.dart';
  import '../model/post_entity.dart';
  import '../network/wp_api.dart';
  import '../widgets/post_list_item.dart';
  import '../widgets/refresh_widget.dart';
  
  class PostsList extends StatefulWidget {
    int category = 0;
    PostsList({this.category = 0});
    @override
    _PostsListState createState() =&gt; _PostsListState();
  }
  
  class _PostsListState extends State&lt;PostsList&gt; {
    final keyRefresh = GlobalKey&lt;RefreshIndicatorState&gt;();
    List&lt;PostEntity&gt; posts = [];
  
    int page = 0;
    ScrollController _scrollController = new ScrollController();
    bool isLoading = false;
  
    @override
    void initState() {
      super.initState();
      getData();
      _scrollController.addListener(() {
        if (_scrollController.position.pixels ==
            _scrollController.position.maxScrollExtent) {
          getData();
        }
      });
    }
  
    Future getData() async {
      keyRefresh.currentState?.show();
      if (!isLoading) {
        setState(() {
          page++;
          isLoading = true;
        });
  
        WpApi.getPostsList(category: widget.category, page: page).then((_posts) {
          setState(() {
            isLoading = false;
            posts.addAll(_posts);
          });
        });
      }
    }
  
    @override
    void dispose() {
      _scrollController.dispose();
      super.dispose();
    }
  
    @override
    Widget build(BuildContext context) =&gt; SizedBox(
          height: 300,
          child: buildList(),
        );
  
    Widget buildList() =&gt; posts.isEmpty
        ? Center(child: CircularProgressIndicator())
        : RefreshWidget(
            keyRefresh: keyRefresh,
            onRefresh: getData,
            child: ListView.builder(
                itemCount: posts.length + 1,
                shrinkWrap: true,
                primary: false,
                controller: _scrollController,
                itemBuilder: (context, index) {
                  if (index == posts.length) {
                    return _buildProgressIndicator();
                  } else {
                    return PostListItem(posts[index]);
                  }
                }));
  
    Widget _buildProgressIndicator() {
      return new Padding(
        padding: const EdgeInsets.all(20.0),
        child: Center(
          child: Visibility(
            visible: isLoading,
            child: CircularProgressIndicator(
              color: Colors.blue,
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>Here's the refresh_widget.dart</p>
  <pre><code>
  import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  
  class RefreshWidget extends StatefulWidget {
    final GlobalKey&lt;RefreshIndicatorState&gt; keyRefresh;
    final Widget child;
    final Future Function() onRefresh;
  
    const RefreshWidget({
      Key key,
      this.keyRefresh,
      @required this.onRefresh,
      @required this.child,
    }) : super(key: key);
  
    @override
    _RefreshWidgetState createState() =&gt; _RefreshWidgetState();
  }
  
  class _RefreshWidgetState extends State&lt;RefreshWidget&gt; {
    @override
    Widget build(BuildContext context) =&gt;
        Platform.isAndroid ? buildAndroidList() : buildIOSList();
  
    Widget buildAndroidList() =&gt; RefreshIndicator(
          key: widget.keyRefresh,
          onRefresh: widget.onRefresh,
          child: widget.child,
        );
  
    Widget buildIOSList() =&gt; CustomScrollView(
          physics: BouncingScrollPhysics(),
          slivers: [
            CupertinoSliverRefreshControl(onRefresh: widget.onRefresh),
            SliverToBoxAdapter(child: widget.child),
          ],
        );
  }
  </code></pre>