nullElement top-level constant
_NullElement
const nullElement
Labels a PageLoaderElement or PageObject as an empty entity. Calling 'exists' on a PageLoaderElement or PageObject annotated with '@nullElement' will always return false. An empty PageLoaderElement or PageObject should be used in place of returning a null value.
PageLoaderElement or PageObjects annotated with this should not have any other annotations. In addition, this annotation should not be used on 'PageLoaderIterable' or on a List.
For example: abstract class MyPO { @ByTagName('item') List
@nullElement
ItemPO get _nullItem;
ItemPO getItemByName(String name) => _items.firstWhere(
(ItemPO item) => item.name == name, orElse: () => _nullItem);
}
Implementation
const nullElement = _NullElement();