encodeTargetPlatform static method

String? encodeTargetPlatform(
  1. TargetPlatform? value
)

Encodes the given value to the String representation. Supported values are:

  • android
  • fuchsia
  • iOS
  • linux
  • macOS
  • windows

All other values, including null, will result in null.

Implementation

static String? encodeTargetPlatform(TargetPlatform? value) {
  String? result;

  if (value != null) {
    switch (value) {
      case TargetPlatform.android:
        result = 'android';
        break;

      case TargetPlatform.fuchsia:
        result = 'fuchsia';
        break;

      case TargetPlatform.iOS:
        result = 'iOS';
        break;

      case TargetPlatform.linux:
        result = 'linux';
        break;

      case TargetPlatform.macOS:
        result = 'macOS';
        break;

      case TargetPlatform.windows:
        result = 'windows';
        break;
    }
  }

  return result;
}