title: flutter riverpod ConsumerWidget not being rebuilt
body: <p>I've just implemented riverpod into a small app I've written.</p>
  <p>flutter_riverpod: ^0.12.1</p>
  <p>My problem is that when I update a provider the widget isn't being rebuilt despite having made a call to 'watch'.</p>
  <p>The provider essentially tracks the current page that should be displayed.</p>
  <pre class="lang-dart prettyprint-override"><code>import 'dart:developer';
  
  import 'package:flutter_riverpod/flutter_riverpod.dart';
  
  final currentPageProvider = StateNotifierProvider((ref) =&gt; CurrentPage());
  
  class CurrentPage extends StateNotifier&lt;int&gt; {
    CurrentPage() : super(-1);
  
    set currentPage(int page) {
      log('currentPage set to $page');
      state = page;
    }
  
    int get currentPage =&gt; state;
  }
  
  </code></pre>
  <p>The PageButtons widget draws a set of RaisedButtons. When a user clicks one of the raised buttons the current page no. should change and the PageButton widget should be rebuilt so we can change the color of the RaisedButton that corresponds to the current page.</p>
  <pre class="lang-dart prettyprint-override"><code>import 'dart:developer';
  import 'dart:math' hide log;
  
  import 'package:flutter/material.dart';
  import 'package:flutter/widgets.dart';
  import 'package:flutter_riverpod/flutter_riverpod.dart';
  import 'package:fsm2/fsm2.dart' hide State;
  import 'package:fsm2_viewer/src/providers/current_page.dart';
  import 'package:fsm2_viewer/src/providers/log_provider.dart';
  
  class PageButtons extends ConsumerWidget {
    final List&lt;SvgFile&gt; pages;
    PageButtons(this.pages);
  
    @override
    Widget build(BuildContext context, ScopedReader watch) {
      /// watch the currentPageProvider so we are rebuilt when the page
      /// no changes.
      int currentPage = watch(currentPageProvider).currentPage;
      log('building PageButons currentPage: $currentPage');
      if (pages.length == 0) {
        return Container(width: 0, height: 0);
      }
  
      currentPage = min(currentPage, pages.length - 1);
  
      var buttons = &lt;Widget&gt;[];
      for (var pageNo = 0; pageNo &lt; pages.length; pageNo++) {
        buttons.add(Padding(
            padding: EdgeInsets.only(right: 5, left: 5),
            child: RaisedButton(
                color: (pageNo == currentPage ? Colors.blue : Colors.grey),
                onPressed: () {
                  context.read(logProvider).log = 'onpressed';
                  /// User click the page button so update the current page.
                  context.read(currentPageProvider).currentPage = pageNo;
                  context.read(logProvider).log = 'changed to page $pageNo';
                },
                child: Text('${pageNo + 1}'))));
      }
      return Row(children: buttons);
    }
  }
  </code></pre>
  <p>You can see in the above build method I call watch:</p>
  <pre class="lang-dart prettyprint-override"><code> int currentPage = watch(currentPageProvider).currentPage;
  </code></pre>
  <p>Then in the onPressed for a Raised button I update the currentPage:</p>
  <pre class="lang-dart prettyprint-override"><code>              onPressed: () {
                  /// User click the page button so update the current page.
                  context.read(currentPageProvider).currentPage = pageNo;
                  context.read(logProvider).log = 'onpressed';                
                  context.read(logProvider).log = 'changed to page $pageNo';
  </code></pre>
  <p>In my logs I see:</p>
  <pre><code>main:ALL&gt; onpressed
  main:ALL&gt; currentPage set to 1
  main:ALL&gt; changed to page 1
  </code></pre>
  <p>The logs tell me that the onPressed method is being called and that I'm updating the currentPageProvider.</p>
  <p>However the PageButtons's builder is not being called.</p>
  <p>What am I doing wrong?</p>