if
above will return a SizedBox()
if the condition fails. For building widget trees, this is usually makes sense. However sometimes we need to pass an argument that can be null, depending on a condition. In these edge cases, use if-null.
AppBar
widget will be set to null if the user.name
is null
.