switchChain method
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;
}