title: Why do I need to cast the value of the Rx object on initialization?
body: <p>Consider this code:</p>
  <pre><code>Rx&lt;Widget&gt; rxwidget = const Text(&quot;test&quot;).obs;
  rxwidget.value = Container();
  </code></pre>
  <p>This will throw the following error on runtime</p>
  <pre><code>Expected a value of type 'Text', but got one of type 'Container'
  </code></pre>
  <p>This seems very illogical to me because the variable only requires it to be a <code>Widget</code> which both are. It somehow restricts the type to the first value it gets.
  But if I write it like this:</p>
  <pre><code>Rx&lt;Widget&gt; rxwidget = (const Text(&quot;test&quot;) as Widget).obs;
  rxwidget.value = Container();
  </code></pre>
  <p>It works fine, but the IDE (Android Studio) actually complains that the cast is unnecessary.<br />
  Note, removing the <code>const</code> keyword doesn't help.</p>
  <p>Another example</p>
  <pre><code>Rx&lt;String?&gt; test = null.obs;
  test.value = &quot;test&quot;;
  </code></pre>
  <p>giving</p>
  <pre><code>Expected a value of type 'Null', but got one of type 'String'
  </code></pre>
  <p>I'm pretty sure it used to work, so I suspect it's a recent change in flutter.</p>
  <p>Is this maybe an error in flutter/dart? Or why is this?</p>
  <p>version info:</p>
  <pre><code>Flutter 2.10.3 • channel stable • https://github.com/flutter/flutter.git
  Framework • revision 7e9793dee1 (2 weeks ago) • 2022-03-02 11:23:12 -0600
  Engine • revision bd539267b4
  Tools • Dart 2.16.1 • DevTools 2.9.2
  </code></pre>