title: Flutter-Riverpod - how to combine providers to filter on a Stream
body: <p>I'm trying to follow the example docs on how to combine Providers using Flutter &amp; Riverpod to filter a list of items. The data is coming from Firestore using Streams:</p>
  <pre><code>final carListProvider = StreamProvider.autoDispose&lt;List&lt;Car&gt;&gt;((ref) {
    final carsRepo = ref.watch(carsRepositoryProvider);
    return carsRepo.cars();
  });
  </code></pre>
  <p>This all works fine and I can render the list of cars no problem. Now I want to give the user the option to filter the list based on color:</p>
  <pre><code>enum CarColorFilter {
    all,
    red,
    white,
    black,
  }
  
  final carListFilter = StateProvider((_) =&gt; CarListFilter.all);
  </code></pre>
  <p>And then following the docs example, my attempt to combine the providers:</p>
  <pre><code>final filteredCars = StreamProvider&lt;List&lt;Car&gt;&gt;((ref) {
    final filter = ref.watch(carListFilter);
    final cars = ref.watch(carListProvider); &lt;-- This line throws the error
  
    switch (filter.state) {
      case CarColorFilter.all:
        return cars;
      case CarColorFilter.red:
        return cars.where(...)
  
      default:
    }
  })
  </code></pre>
  <p>On the line declaring the 'cars' variable the editor complains:</p>
  <blockquote>
  <p>The argument type 'AutoDisposeStreamProvider&lt;List&gt;' can't be
  assigned to the parameter type 'AlwaysAliveProviderBase&lt;Object,
  dynamic&gt;'</p>
  </blockquote>
  <p>I think the difference between my use case and the docs is that in the example given the <code>List&lt;Todo&gt;</code> is a <code>StateNotifierProvider</code> whereas in my case the <code>List&lt;Car&gt;</code> is a <code>StreamProvider</code>. Any help would be much appreciated.</p>