dvPurchaseChannel function
The channel this build sells from.
--dart-define=DARTVEL_PURCHASE_CHANNEL=desktop overrides it, for a macOS
build distributed outside the Mac App Store, where StoreKit cannot sell.
Implementation
DVPurchaseChannel dvPurchaseChannel() {
const String declared = String.fromEnvironment('DARTVEL_PURCHASE_CHANNEL');
final DVPurchaseChannel? named =
DVPurchaseChannel.values.asNameMap()[declared];
if (named != null) return named;
if (kIsWeb) return DVPurchaseChannel.web;
return switch (defaultTargetPlatform) {
TargetPlatform.iOS || TargetPlatform.macOS => DVPurchaseChannel.appStore,
TargetPlatform.android => DVPurchaseChannel.play,
_ => DVPurchaseChannel.desktop,
};
}