switchChain method

  1. @override
Future<void> switchChain(
  1. String chain
)
override

Switches the selected chain used for subsequent transactions. Throws ArgumentError when chain is not in supportedChains. Called by the hosted checkout when the user changes chain in the UI.

Implementation

@override
Future<void> switchChain(String chain) async {
  final String normalizedChain = chain.trim();
  if (!supportedChains.contains(normalizedChain)) {
    throw ArgumentError.value(
      chain,
      'chain',
      'Unsupported checkout chain for this payer.',
    );
  }
  _selectedChain = normalizedChain;
}