PixaRuntimePlatformContract.forPlatform constructor

PixaRuntimePlatformContract.forPlatform(
  1. TargetPlatform platform
)

Returns the platform contract for a Flutter platform.

Implementation

factory PixaRuntimePlatformContract.forPlatform(TargetPlatform platform) {
  return switch (platform) {
    TargetPlatform.android => android,
    TargetPlatform.iOS => iOS,
    TargetPlatform.macOS => macOS,
    TargetPlatform.windows => windows,
    TargetPlatform.linux => linux,
    TargetPlatform.fuchsia => throw UnsupportedError(
      'Pixa has no platform contract for fuchsia.',
    ),
  };
}