maybeSelectAndPop method

  1. @protected
  2. @optionalTypeArgs
T maybeSelectAndPop(
  1. T item,
  2. BuildContext context
)

Selects the given item and pops the current route.

This method calls the onSelect callback with the selected item and then pops the current route using maybePop() from the context.

Returns the selected item.

Implementation

@protected
@optionalTypeArgs
T maybeSelectAndPop(T item, BuildContext context) {
  onSelect?.call(item);
  unawaited(context.maybePop());

  return item;
}