title: Gridview is not updating even after setState call
body: <p>I am maintaining a flutter app since 5 months. Everything was working fine till yesterday. Today I upgraded flutter to latest version 1.20.1 and the app started breaking.</p>
  <p>I have a Screen with Two tabs.
  First tab contains ListView where user chooses how many gridview items to build then it animates to second tab containing GridView which builds the selected items.
  Number of grid items to build is stored on <strong>_chapterCount</strong> variable.</p>
  <p>It was working absolutely fine till yesterday but after upgrading it didn't work. There are no any exceptions too.</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:provider/provider.dart';
  
  import '../models/book.dart';
  import '../providers/font.dart';
  
  class ChoiceScreen extends StatefulWidget {
    @override
    _ChoiceScreenState createState() =&gt; _ChoiceScreenState();
  }
  
  class _ChoiceScreenState extends State&lt;ChoiceScreen&gt; {
    int _chapterCount = 0;
    int _id = 0;
    int _initialIndex = 0;
  
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Consumer&lt;FontManager&gt;(builder: (context, manager, _) {
          return DefaultTabController(
            length: 2,
            initialIndex: _initialIndex,
            child: Scaffold(
              appBar: AppBar(
                title: TabBar(
                  tabs: [
                    Tab(
                      child: Text(
                        'Book',
                        style: TextStyle(fontSize: manager.fontSize),
                      ),
                    ),
                    Tab(
                      child: Text(
                        'Chapter',
                        style: TextStyle(fontSize: manager.fontSize),
                      ),
                    ),
                  ],
                ),
              ),
              body: TabBarView(
                children: [
                  ListView.builder(
                    itemCount: BOOK.length,
                    itemBuilder: (ctx, i) {
                      return buildListTile(
                          ctx,
                          BOOK.firstWhere((test) =&gt; test.id == i + 1),
                          manager.fontSize);
                    },
                  ),
                  buildGridView(manager, context, _chapterCount),
                ],
              ),
            ),
          );
        }),
      );
    }
  
    GridView buildGridView(
        FontManager manager, BuildContext context, int chapterCount) {
      print('building gridView $chapterCount'); //Updated value is printed here but no element gets built
      return GridView.builder(
        gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
          maxCrossAxisExtent: 50,
          crossAxisSpacing: 10,
          mainAxisSpacing: 10,
        ),
        itemCount: chapterCount,
        itemBuilder: (ctx, i) {
          return InkWell(
            child: Container(
              child: Center(
                child: Text(
                  (i + 1).toString(),
                  style:
                      TextStyle(color: Colors.white, fontSize: manager.fontSize),
                ),
              ),
              decoration: BoxDecoration(color: Colors.deepPurple),
            ),
            onTap: () {
              Navigator.of(context).pop({
                'chapter': i,
                'id': _id,
              });
            },
          );
        },
      );
    }
  
    Widget buildListTile(BuildContext ctx, Book book, double fontSize) {
      return InkWell(
        child: ListTile(
          leading: Text((book.id).toString()),
          title: Text(
            book.title,
            style: TextStyle(fontSize: fontSize),
          ),
        ),
        onTap: () {
          setState(() {
            _chapterCount = book.chapter;
            _id = book.id;
          });
          DefaultTabController.of(ctx).animateTo(1);
        },
      );
    }
  }
  
  </code></pre>
  <p>When calling setState the Widget rebuilds and the <strong>_chapterCount</strong> variable is also updated. Even gridView builder function get the updated <strong>_chapterCount</strong> but it doesn't build.
  Strange thing is that the GridView builds items when I hot reload from VSCode after setState has been called.</p>