encodeFontWeight static method

String? encodeFontWeight(
  1. FontWeight? value
)

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

  • w100
  • w200
  • w300
  • w400
  • w500
  • w600
  • w700
  • w800
  • w900

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

Implementation

static String? encodeFontWeight(FontWeight? value) {
  String? result;

  if (value != null) {
    switch (value) {
      // case FontWeight.bold:
      //   result = 'bold';
      //   break;

      // case FontWeight.normal:
      //   result = 'normal';
      //   break;

      case FontWeight.w100:
        result = 'w100';
        break;

      case FontWeight.w200:
        result = 'w200';
        break;

      case FontWeight.w300:
        result = 'w300';
        break;

      case FontWeight.w400:
        result = 'w400';
        break;

      case FontWeight.w500:
        result = 'w500';
        break;

      case FontWeight.w600:
        result = 'w600';
        break;

      case FontWeight.w700:
        result = 'w700';
        break;

      case FontWeight.w800:
        result = 'w800';
        break;

      case FontWeight.w900:
        result = 'w900';
        break;
    }
  }

  return result;
}