Add null-checking helper function for NNBD libraries.
Add null-checking helper function for NNBD libraries.

Change-Id: I4d53ac27fd347c2d81b1d68d023e1da5abd9e3ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136631
Commit-Queue: Lasse R.H. Nielsen <80295e4ef244a07779f93eaa95d582bad8e316a5@google.com>
Reviewed-by: Erik Ernst <251bb01623bfda2cd9151e339a6e783ca432874c@google.com>

dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk