'Null check operator used on a null value, null safety causing many errors

First I had a problem that I fixed by changing late String myName, myProfilePic, myUserName, myEmail; to String? myName, myProfilePic, myUserName, myEmail;, that required me to add a null check operator (!) to to var chatRoomId = getChatRoomIdByUsernames(myUserName, username);, (So it changes to var chatRoomId = getChatRoomIdByUsernames(myUserName!, username); but then it gives me that error. Can anyone tell me what to do? When I don't use (!) then the error on myUserName is "The argument type 'String?' can't be assigned to the parameter type 'String'".



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source