visiblePaymentMethods static method

List<LokotroPaymentMethod> visiblePaymentMethods(
  1. List<LokotroPaymentMethod> methods
)

Filters a payment-method list down to the methods that should be visible to the user, dropping any that are hidden behind a disabled feature flag.

Currently this removes Google Pay / Apple Pay whenever LokotroPayFeatureFlags.nativeWalletsEnabled is false, so they are never rendered or auto-selected. The original list is returned unchanged once the flag is enabled.

Implementation

static List<LokotroPaymentMethod> visiblePaymentMethods(
  List<LokotroPaymentMethod> methods,
) {
  if (LokotroPayFeatureFlags.nativeWalletsEnabled) return methods;
  return methods.where((method) => !_isNativeWalletMethod(method)).toList();
}