getComponent<T> method

T? getComponent<T>()

Returns the first attached component of type T, or null.

Implementation

T? getComponent<T>() {
  for (final component in _components) {
    if (component is T) return component as T;
  }
  return null;
}