of static method

ElementKind of(
  1. Element? element
)

Returns the kind of the given element, or ERROR if the element is null.

This is a utility method that can reduce the need for null checks in other places.

Implementation

static ElementKind of(Element? element) {
  if (element == null) {
    return ERROR;
  }
  return element.kind;
}