findToken method

TokenCard findToken(
  1. int orderInSet, [
  2. String? debugAssertName
])

Looks up a token in this collection by its orderInSet.

If the card is not found, throws a StateError.

If debugAssertName is provided, in debug mode (assertions enabled) the card's name will be checked against it, exactly as written. This is useful for debugging, but should not be relied upon.

Implementation

TokenCard findToken(int orderInSet, [String? debugAssertName]) {
  final result = tryFindToken(orderInSet, debugAssertName);
  if (result != null) {
    return result;
  }
  throw StateError('Token not found: $orderInSet');
}