why is the null-check of an outer variable isn't enough in dart?
Since this variable is not an inline variable, we can't be sure that it will not change between checking and using. You may be calling another function inside your condition block and that function sets that global variable to null. So to have sound null-safety type promotion only works on inline variables.
In your case, you can use fab?.call()
without checking the variable isn't null or fab!()
inside your condition block. Read more here.