launch method

Launches the native store flow for the current platform.

Implementation

Future<StoreLaunchResult> launch() async {
  if (kIsWeb) return StoreLaunchResult.unavailable;
  try {
    final result = await _channel.invokeMethod<String>('launchStore', {
      'appleId': iosAppleId,
    });
    return switch (result) {
      'launched' => StoreLaunchResult.launched,
      'unavailable' => StoreLaunchResult.unavailable,
      _ => StoreLaunchResult.failed,
    };
  } on MissingPluginException {
    // Running in an environment without the native side (e.g. tests,
    // unsupported embedding). Fall back gracefully.
    return StoreLaunchResult.unavailable;
  } on PlatformException {
    return StoreLaunchResult.failed;
  }
}