title: hooks_riverpod: Flutter Firebase auth with Riverpod, error occur: a provider tried to assign `null` to a non-nullable `exposedvalue`"
body: <p>I try to implement Firebase Auth for Flutter according to this tutorial: <a href="https://youtu.be/vrPk6LB9bjo?t=393" rel="nofollow noreferrer">https://youtu.be/vrPk6LB9bjo?t=393</a></p>
  <p>The Widget should check whether the user is login using riverpod hook method and provider and load either HomeScreen or LoginScreen Widget.</p>
  <p><strong>main.dart</strong></p>
  <pre><code>class AuthWrapper extends HookWidget {
        const AuthWrapper({Key key}) : super(key: key);
      
        @override
        Widget build(BuildContext context) {
          final authControllerState = useProvider(authControllerProvider.state);
          print(authControllerState);
      
          if (authControllerState != null) {
            return const HomeScreen();
          }
          return LoginScreen();
        }
      }
  </code></pre>
  <p><strong>Provider Controller:</strong></p>
  <pre><code>final authControllerProvider = StateNotifierProvider&lt;AuthController&gt;(
    (ref) =&gt; AuthController(ref.read),
  );
  
  class AuthController extends StateNotifier&lt;User?&gt; {
    final Reader _read;
  
    StreamSubscription&lt;User?&gt;? _authStateChangeSubscription;
  
    AuthController(this._read) : super(null) {
      _authStateChangeSubscription?.cancel();
      _authStateChangeSubscription =
          _read(authProvider).authStateChanges.listen((user) {
        state = user;
      });
    }
  }
  </code></pre>
  <p><strong>But I got this error.</strong></p>
  <blockquote>
  <p>'package:riverpod/src/framework/base provider.dart': failed assertion:
  line 944 pos 7: 'exposedvalue is listened': a provider tried to assign
  <code>null</code> to a non-nullable <code>exposedvalue</code></p>
  </blockquote>
  <p><em>I think the error might be in the implementation of the Provider Controller but I don't know how I should do it differently.</em></p>
  <p>Does anyone have an idea how I could fix this error?</p>