deserialize method

  1. @override
void deserialize(
  1. Map<String, dynamic>? json
)
override

Implementation

@override
void deserialize(Map<String, dynamic>? json) {
  if (json == null) {
    throw ApiException(400, 'Failed to deserialize FieldOptions data model.');
  }

  if (json.containsKey('CurrentUser')) {
    currentUser = ModelBase.createInstance<UserInformation>(
        json['CurrentUser'] as Map<String, dynamic>);
  } else {
    currentUser = null;
  }

  if (json.containsKey('CustomTocStyleSeparator')) {
    customTocStyleSeparator = json['CustomTocStyleSeparator'] as String;
  } else {
    customTocStyleSeparator = null;
  }

  if (json.containsKey('DefaultDocumentAuthor')) {
    defaultDocumentAuthor = json['DefaultDocumentAuthor'] as String;
  } else {
    defaultDocumentAuthor = null;
  }

  if (json.containsKey('FieldIndexFormat')) {
    switch (json['FieldIndexFormat'] as String) {
      case 'Template':
        fieldIndexFormat = FieldOptions_FieldIndexFormatEnum.template;
        break;
      case 'Classic':
        fieldIndexFormat = FieldOptions_FieldIndexFormatEnum.classic;
        break;
      case 'Fancy':
        fieldIndexFormat = FieldOptions_FieldIndexFormatEnum.fancy;
        break;
      case 'Modern':
        fieldIndexFormat = FieldOptions_FieldIndexFormatEnum.modern;
        break;
      case 'Bulleted':
        fieldIndexFormat = FieldOptions_FieldIndexFormatEnum.bulleted;
        break;
      case 'Formal':
        fieldIndexFormat = FieldOptions_FieldIndexFormatEnum.formal;
        break;
      case 'Simple':
        fieldIndexFormat = FieldOptions_FieldIndexFormatEnum.simple;
        break;
      default:
        fieldIndexFormat = null;
        break;
    }
  } else {
    fieldIndexFormat = null;
  }

  if (json.containsKey('FieldUpdateCultureName')) {
    fieldUpdateCultureName = json['FieldUpdateCultureName'] as String;
  } else {
    fieldUpdateCultureName = null;
  }

  if (json.containsKey('FieldUpdateCultureSource')) {
    switch (json['FieldUpdateCultureSource'] as String) {
      case 'CurrentThread':
        fieldUpdateCultureSource =
            FieldOptions_FieldUpdateCultureSourceEnum.currentThread;
        break;
      case 'FieldCode':
        fieldUpdateCultureSource =
            FieldOptions_FieldUpdateCultureSourceEnum.fieldCode;
        break;
      default:
        fieldUpdateCultureSource = null;
        break;
    }
  } else {
    fieldUpdateCultureSource = null;
  }

  if (json.containsKey('FileName')) {
    fileName = json['FileName'] as String;
  } else {
    fileName = null;
  }

  if (json.containsKey('IsBidiTextSupportedOnUpdate')) {
    isBidiTextSupportedOnUpdate = json['IsBidiTextSupportedOnUpdate'] as bool;
  } else {
    isBidiTextSupportedOnUpdate = null;
  }

  if (json.containsKey('LegacyNumberFormat')) {
    legacyNumberFormat = json['LegacyNumberFormat'] as bool;
  } else {
    legacyNumberFormat = null;
  }

  if (json.containsKey('PreProcessCultureName')) {
    preProcessCultureName = json['PreProcessCultureName'] as String;
  } else {
    preProcessCultureName = null;
  }

  if (json.containsKey('TemplateName')) {
    templateName = json['TemplateName'] as String;
  } else {
    templateName = null;
  }

  if (json.containsKey('UseInvariantCultureNumberFormat')) {
    useInvariantCultureNumberFormat =
        json['UseInvariantCultureNumberFormat'] as bool;
  } else {
    useInvariantCultureNumberFormat = null;
  }

  if (json.containsKey('BuiltInTemplatesPaths')) {
    // Array processing
    builtInTemplatesPaths = <String>[];
    for (final _element in json['BuiltInTemplatesPaths']) {
      builtInTemplatesPaths!.add(_element as String);
    }
  } else {
    builtInTemplatesPaths = null;
  }
}