getHoverElevation method Null safety

double getHoverElevation(
  1. MaterialButton button

The button's elevation when it is enabled and has focus.

Returns the button's MaterialButton.hoverElevation if it is non-null.

If button is a FlatButton then the hover elevation is 0.0, otherwise the highlight elevation is 4.0.


double getHoverElevation(MaterialButton button) {
  if (button.hoverElevation != null)
    return button.hoverElevation!;
  if (button is FlatButton)
    return 0.0;
  return 4.0;