Every time I Run my project, It redirects me to home page as if provider is always returning null value for user. This is my wrapper.dart file

import 'package:brew_crew/models/user.dart';
import 'package:brew_crew/screens/authentication/authentication.dart';
import 'package:brew_crew/screens/home/home.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class Wrapper extends StatelessWidget {
  @override
  Widget build(BuildContext context) {

    MyUser? user = Provider.of<MyUser?>(context);

    // return either the Home or Authenticate widget
    if (user == null) {
      return Authenticate();
    } else {
      return Home();
    }
  }
}

this is my MyUser class :

class MyUser {
  final String uid;
  MyUser({required this.uid});
}

Error in the debug console is :


════════ Exception caught by provider ══════════════════════════════════════════
The following assertion was thrown:
An exception was throw by _MapStream<QuerySnapshot<Map<String, dynamic>>, List<Brew>> listened by

StreamProvider<List<Brew>>, but no `catchError` was provided.

Exception:
Bad state: field does not exist within the DocumentSnapshotPlatform