decodeSystemUiOverlayStyle static method

SystemUiOverlayStyle? decodeSystemUiOverlayStyle(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes a value to a SystemUiOverlayStyle. Supported values are:

  • dark
  • light

Implementation

static SystemUiOverlayStyle? decodeSystemUiOverlayStyle(
  dynamic value, {
  bool validate = true,
}) {
  SystemUiOverlayStyle? result;
  if (value is SystemUiOverlayStyle) {
    result = value;
  } else {
    _checkSupported(
      'SystemUiOverlayStyle',
      [
        'dark',
        'light',
      ],
      value,
    );

    if (value != null) {
      assert(SchemaValidator.validate(
        schemaId: '$_baseSchemaUrl/system_ui_overlay_style',
        value: value,
        validate: validate,
      ));
      switch (value) {
        case 'dark':
          result = SystemUiOverlayStyle.dark;
          break;

        case 'light':
          result = SystemUiOverlayStyle.light;
          break;
      }
    }
  }

  return result;
}