rootElementOf function

PageLoaderElement rootElementOf(
  1. dynamic item
)

Grabs the root element of a PageObject. Same as getting a '@root' annotated getter within the PageObject. If a PageLoaderElement is passed, returns it back.

Implementation

PageLoaderElement rootElementOf(dynamic item) {
  if (item is PageLoaderElement) {
    return item;
  }
  try {
    return item.$root;
  } on NoSuchMethodError {
    throw PageLoaderArgumentError.onWrongType(
        'rootElementOf', item.runtimeType);
  }
}