accessOneAction<TAction extends AFActionWithKey> method

TAction accessOneAction<TAction extends AFActionWithKey>()

Implementation

TAction accessOneAction<TAction extends AFActionWithKey>() {
  final found = actions.whereType<TAction>();
  if(found.isEmpty) {
    throw AFException("Failed to find action of type $TAction");
  }

  if(found.length > 1) {
    throw AFException("Found more than one action of type $TAction");
  }

  return found.first;
}