title: How to update streamProvider stream based on other providers value
body: <p>I want to update StreamProvider stream, based on the value of the Provider. I arrived at this solution.</p>
  <pre><code>return Provider&lt;SelectedDay&gt;.value(
            value: selectedDay,
            child: ProviderToStream&lt;SelectedDay&gt;(
              builder: (_, dayStream, Widget child) {
                return StreamProvider&lt;DailyHomeData&gt;(
                  initialData: DailyHomeData.defaultValues(DateTime.now()),
                  create: (_) async* {
                    await for (final selectedDay in dayStream) {
                      yield await db
                          .dailyHomeDataStream(
                              dateTime: selectedDay.selectedDateTime)
                          .first;
                    }
                  },
                  child: MainPage(),
                );
              },                
            ),
          );
  </code></pre>
  <p>This is the providerToStream class, which i copied from here <a href="https://stackoverflow.com/questions/57241349/trouble-rebuilding-a-streamprovider-to-update-its-current-data">Trouble rebuilding a StreamProvider to update its current data</a></p>
  <pre><code>class ProviderToStream&lt;T&gt; extends StatefulWidget {
    const ProviderToStream({Key key, this.builder, this.child}) : super(key: key);
  
    final ValueWidgetBuilder&lt;Stream&lt;T&gt;&gt; builder;
    final Widget child;
  
    @override
    _ProviderToStreamState&lt;T&gt; createState() =&gt; _ProviderToStreamState&lt;T&gt;();
  }
  
  class _ProviderToStreamState&lt;T&gt; extends State&lt;ProviderToStream&gt; {
    final StreamController&lt;T&gt; controller = StreamController&lt;T&gt;();
  
    @override
    void dispose() {
      controller.close();
      super.dispose();
    }
  
    @override
    void didChangeDependencies() {
      super.didChangeDependencies();
      controller.add(Provider.of&lt;T&gt;(context));
    }
  
    @override
    Widget build(BuildContext context) {
      return widget.builder(context, controller.stream, widget.child);
    }
  }
  </code></pre>
  <p>And this is the error i get when i try to use it</p>
  <pre><code>type '(BuildContext, Stream&lt;SelectedDay&gt;, Widget) =&gt; StreamProvider&lt;DailyHomeData&gt;' is not a subtype of type '(BuildContext, Stream&lt;dynamic&gt;, Widget) =&gt; Widget'
  </code></pre>
  <p>Note: The code doesnt even work when i place a dummy widget inside the ProviderToStream widget.</p>
  <pre><code> child: ProviderToStream&lt;SelectedDay&gt;(
                builder: (_, ___, Widget child) {
                  return child;
                },
              ),
  </code></pre>
  <p>I also tried to force somehow the type in the builder, so that it is not dynamic, with no luck</p>
  <pre><code>   child: ProviderToStream&lt;SelectedDay&gt;(
                builder: (_, Stream&lt;SelectedDay&gt; dayStream, Widget child) {
                  return child;
                },
              ),
  </code></pre>