title: Riverpod showing snackbar on Error and also last known list using statenotifier
body: <p>I am using riverpod ^1.0.0. I have created a StateClass which extends Equatable. In my StateNotifier i set state depending on events and outcomes. One being an async http request which upon success sets</p>
  <p>state=SalesOrderListSuccess(salesOrderListItems: _items);</p>
  <p>Upon http client failure however i set state to:</p>
  <p>state = SalesOrderListError(error: response.data);</p>
  <p>This works, upon success it renders the list in below UI builder. And it also using ref.listen and shows the snackbar. However, because the state changes from SalesOrderListSuccess and i am using ref.watch it seems that it cant keep the former known list and UI. How can i show the snackbar above the last known SalesOrderListSuccess/UI without rendering an entire new Error Page that is empty of all the items i have already managed to render in the list ?</p>
  <p>Basically i dont want the list to change, just show a snackbar above last known list before the http client error happend.</p>
  <p>Here the current widget: (this requires the SalesOrderListSuccess state in order to show the list).</p>
  <pre><code>  @override
    Widget build(BuildContext context, WidgetRef ref) {    
  
      final todos = ref.watch(todoListProvider);
      final selectedtrack = ref.read(selectedProductIdProvider2.notifier);
  
      ref.listen(todoListProvider, (previous, count) {
        print(previous);
        print(count);
        switch (count.runtimeType) {
          case SalesOrderListError:
            ScaffoldMessenger.of(context).showSnackBar(
              const SnackBar(content: Text('Ohh no some error happend')),
            );
        }
      });
  
      return ListView.builder(
        shrinkWrap: true, // 1st add
        physics: ClampingScrollPhysics(),
        itemCount: (todos as SalesOrderListSuccess).salesOrderListItems.length,
        itemBuilder: (context, index) {
          final current=
              (todos as SalesOrderListSuccess).salesOrderListItems[index];
          return ListTile(
              title: Text('${current.title}'),
              onTap: () {
                selectedtrack.state = index;
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) =&gt; DetailScreen(),
                  ),
                );
              });
        },
      );
  
    }
  
  </code></pre>