preferredHeightFor method Null safety

double preferredHeightFor(
  1. BuildContext context,
  2. Size preferredSize
)

Used by Scaffold to compute its AppBar's overall height. The returned value is the same preferredSize.height unless AppBar.toolbarHeight was null and AppBarTheme.of(context).toolbarHeight is non-null. In that case the return value is the sum of the theme's toolbar height and the height of the app bar's AppBar.bottom widget.

Implementation

static double preferredHeightFor(BuildContext context, Size preferredSize) {
  if (preferredSize is _PreferredAppBarSize && preferredSize.toolbarHeight == null) {
    return (AppBarTheme.of(context).toolbarHeight ?? kToolbarHeight) + (preferredSize.bottomHeight ?? 0);
  }
  return preferredSize.height;
}