getHighlightElevation method Null safety

double getHighlightElevation(
  1. MaterialButton button

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

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

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


double getHighlightElevation(MaterialButton button) {
  if (button.highlightElevation != null)
    return button.highlightElevation!;
  if (button is FlatButton)
    return 0.0;
  return 8.0;