pixaPlatformStatusForProbe function

  1. @visibleForTesting
PixaRuntimePlatformStatus pixaPlatformStatusForProbe({
  1. required bool isWeb,
  2. required TargetPlatform targetPlatform,
  3. required bool runtimeAvailable,
})

Evaluates platform status from explicit probe inputs.

This is kept internal to make unsupported-platform behavior testable without weakening the runtime guard or adding a Dart fallback route.

Implementation

@visibleForTesting
PixaRuntimePlatformStatus pixaPlatformStatusForProbe({
  required bool isWeb,
  required TargetPlatform targetPlatform,
  required bool runtimeAvailable,
}) {
  final String platform = isWeb ? 'web' : targetPlatform.name;
  final bool platformSupported = _isSupportedPlatform(targetPlatform);
  final bool supported = !isWeb && platformSupported;
  if (!supported) {
    return PixaRuntimePlatformStatus(
      platform: platform,
      isWeb: isWeb,
      isSupportedPlatform: false,
      runtimeAvailable: false,
      message: isWeb
          ? 'Pixa does not support Web; use a Flutter platform.'
          : 'Pixa runtime core is not supported on $platform.',
    );
  }
  final PixaRuntimePlatformContract contract =
      PixaRuntimePlatformContract.forPlatform(targetPlatform);
  return PixaRuntimePlatformStatus(
    platform: platform,
    isWeb: false,
    isSupportedPlatform: true,
    runtimeAvailable: runtimeAvailable,
    contract: contract,
    message: runtimeAvailable
        ? 'Pixa runtime core is available on $platform.'
        : 'Pixa runtime symbols are unavailable on $platform.',
  );
}