New post on /r/flutterdev subreddit:
<b>Current User called to null</b>
I have loaded the project and there is no error. But when I want to open the search screen for me to search for other users, it brings an error of "User call to null"​This is my Search Screen​import 'package:firebase_auth/firebase_auth.dart';import 'package:flutter/material.dart';import 'package:scrolly/models/user.dart' as user;import 'package:scrolly/resources/firebase_repository.dart';import 'package:scrolly/screens/chat_screen.dart';import 'package:scrolly/screens/widgets/custom_tile.dart';import 'package:scrolly/utils/universal_variables.dart';​class SearchScreen extends StatefulWidget {<a href="/u/override">u/override</a>_SearchScreenState createState() => _SearchScreenState();}​class _SearchScreenState extends State<SearchScreen> {final FirebaseRepository _firebaseRepository = FirebaseRepository();​List<User> userList;String query = "";TextEditingController searchController = TextEditingController();FirebaseAuth auth = FirebaseAuth.instance;​<a href="/u/override">u/override</a>void initState() {super.initState();​_firebaseRepository.getCurrentUser().then((User user) {_firebaseRepository.fetchAllUsers(user).then((List<User> list) {setState(() {userList = list;});});});}​searchAppBar(BuildContext context) {return AppBar(leading: IconButton(icon: Icon(Icons.arrow_back, color: Colors.white),onPressed: () => Navigator.pop(context),),elevation: 10,bottom: PreferredSize(preferredSize: const Size.fromHeight(kToolbarHeight + 20),child: Padding(padding: EdgeInsets.only(left: 20),child: TextField(controller: searchController,onChanged: (val) {setState(() {query = val;});},cursorColor: UniversalVariables.blackColor,autofocus: true,style: TextStyle(fontWeight: FontWeight.bold,color: Colors.white,fontSize: 35,),decoration: InputDecoration(suffixIcon: IconButton(icon: Icon(Icons.close, color: Colors.white),onPressed: () {WidgetsBinding.instance.addPostFrameCallback((_) => searchController.clear());},),border: InputBorder.none,hintText: "Search",hintStyle: TextStyle(fontWeight: FontWeight.bold,fontSize: 35,color: Color(0x88ffffff),),),),),),);}​buildSuggestions(String query) {final List<User> suggestionList = query.isEmpty? []: userList != null? userList.where((user) {String _getUsername = user.email.toLowerCase();String _query = query.toLowerCase();String _getName = user.displayName.toLowerCase();bool matchesUsername = _getUsername.contains(_query);bool matchesName = _getName.contains(_query);​return (matchesUsername || matchesName);​// (User user) => (user.username.toLowerCase().contains(query.toLowerCase()) ||// (user.name.toLowerCase().contains(query.toLowerCase()))),}).toList(): [];​return ListView.builder(itemCount: suggestionList.length,itemBuilder: ((context, index) {User searchedUser = user.UUser(uid: suggestionList[index].uid,profilePhoto: suggestionList[index].photoURL,name: suggestionList[index].displayName,username: suggestionList[index].email) as User;​return CustomTile(mini: false,onTap: () {Navigator.push(context,MaterialPageRoute(builder: (context) => ChatScreen(receiver: searchedUser,)));},leading: CircleAvatar(backgroundImage: NetworkImage(searchedUser.photoURL),backgroundColor: Colors.grey,),title: Text(<a href="
https://searchedUser.email">
searchedUser.email</a>,style: TextStyle(color: Colors.white,fontWeight: FontWeight.bold,),),subtitle: Text(searchedUser.displayName,style: TextStyle(color: UniversalVariables.greyColor),),);}),);}​<a href="/u/override">u/override</a>Widget build(BuildContext context) {return Scaffold(backgroundColor: UniversalVariables.blackColor,appBar: searchAppBar(context),body: Container(padding: EdgeInsets.symmetric(horizontal: 20),child: buildSuggestions(query),),);}}​​**USER MODEL CLASS**​class UUser {String uid;String name;String email;String username;String status;int state;String profilePhoto;​UUser({this.uid…