title: Null check used on null value
body: <p>I keep on getting 'Null check operator used on null value' when i try to write user information onto firestore . How can i possibly fix this error?</p>
  <p>here's a snippet of the code where im trying to implement this-</p>
  <pre><code>    Widget build(BuildContext context) {
      final UserProvider userProvider = Provider.of&lt;UserProvider&gt;(context);
      return Scaffold(
        appBar: AppBar(
          elevation: 1.0,
          iconTheme: const IconThemeData(
            color: Colors.black,
          ),
          title: const Text(
            &quot;Inventory&quot;,
            style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold),
          ),
          backgroundColor: Colors.white,
        ),
        body: SingleChildScrollView(
          child: Container(
            padding: const EdgeInsets.symmetric(vertical: 60.0, horizontal: 16.0),
            child: Column(
              children: &lt;Widget&gt;[
                GestureDetector(
                  onTap: () =&gt; _selectImage(context),
                  child: Container(
                    margin: const EdgeInsets.only(),
                    width: MediaQuery.of(context).size.width,
                    height: 210.0,
                    decoration: BoxDecoration(
                      image: DecorationImage(
                        image: _file == null
                            ? const NetworkImage(
                                    'https://i.stack.imgur.com/l60Hf.png')
                                as ImageProvider
                            : MemoryImage(_file!),
                      ),
                    ),
                  ),
                ),
                const SizedBox(
                  height: 10,
                ),
                Container(
                  padding: const EdgeInsets.only(top: 10),
                  width: MediaQuery.of(context).size.width,
                  margin: const EdgeInsets.symmetric(horizontal: 20),
                  child: TextFieldInput(
                    maxLines: 1,
                    maxLength: TextField.noMaxLength,
                    controller: _mealNameController,
                    labelText: 'Meal Name',
                  ),
                ),
                Container(
                  padding: const EdgeInsets.only(top: 10),
                  width: MediaQuery.of(context).size.width,
                  margin: const EdgeInsets.symmetric(horizontal: 20),
                  child: TextFieldInput(
                    maxLines: 1,
                    maxLength: TextField.noMaxLength,
                    controller: _priceController,
                    labelText: 'price',
                  ),
                ),
                Container(
                  padding: const EdgeInsets.only(top: 10),
                  width: MediaQuery.of(context).size.width,
                  margin: const EdgeInsets.symmetric(horizontal: 20),
                  child: TextFieldInput(
                    maxLines: 5,
                    controller: _mealDescriptionController,
                    labelText: 'Meal description',
                    maxLength: 150,
                  ),
                ),
                const SizedBox(height: 28.0),
                Column(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    mealSize(context),
                    const SizedBox(height: 9.0),
                    mealSize(context),
                    const SizedBox(height: 9.0),
                    mealSize(context),
                  ],
                ),
                const SizedBox(height: 40.0),
                GestureDetector(
                    onTap: () =&gt; addMenu(userProvider.getUser.name),
                    child: const Button(btnText: &quot;Add Food Item&quot;)),
              ],
            ),
          ),
        ),
      );
    }
  </code></pre>
  <p>userprovider.dart:</p>
  <pre><code>    class UserProvider with ChangeNotifier {
    User? _user;
  
    final AuthController _authMethods = AuthController();
  
    User get getUser =&gt; _user!;
  
    Future&lt;void&gt; refreshUser() async {
      User user = await _authMethods.getUserDetails();
      _user = user;
      notifyListeners();
    }
  }
  </code></pre>
  <p>This is the error i get when I call the function:</p>
  <pre><code>══════ Exception caught by gesture ═══════════════════════════════════════════
  The following _CastError was thrown while handling a gesture:
  Null check operator used on a null value
  
  When the exception was thrown, this was the stack
  #0      `UserProvider.getUse`r
  package:webite/provider/user_provider.dart:11
  #1      _AddMealState.build.&lt;anonymous closure&gt;
  </code></pre>