As hinted in https://dart-review.googlesource.com/c/sdk/+/277100/comment/e2373f61_88a6ed41/ It is better to have a utility method, used by both fixes.