toJson method Null safety

Map<String, dynamic> toJson()

Convert to a data structure that can be serialized as JSON.

Implementation

Map<String, dynamic> toJson() {
  final r = <String, dynamic>{
    'menuEnabled': menuEnabled.value,
    'windowEnabled': _windowEnabled,
    'euroComma': _euroComma,
    'showAccelerators': showAccelerators.value,
    'systemOverlaysDisabled': systemOverlaysDisabled,
    'orientation': orientation.index
  };
  if (_model.modelName != '15C') {
    r['showWordSize'] = _showWordSize;
    r['hideComplement'] = _hideComplement;
    r['integerModeCommas'] = _integerModeCommas;
  }
  if (_msPerInstruction != null) {
    r['msPerInstruction'] = _msPerInstruction;
  }
  if (_traceProgramToStdout) {
    r['traceProgramToStdout'] = _traceProgramToStdout;
  }
  if (fTextColor != _fTextColorDefault) {
    r['fTextColor'] = fTextColor;
  }
  if (fKeyColor != _fKeyColorDefault) {
    r['fKeyColor'] = fKeyColor;
  }
  if (gTextColor != _gTextColorDefault) {
    r['gTextColor'] = gTextColor;
  }
  if (gKeyColor != _gKeyColorDefault) {
    r['gKeyColor'] = gKeyColor;
  }
  if (lcdBackgroundColor != _lcdBackgroundColorDefault) {
    r['lcdBackgroundColor'] = lcdBackgroundColor;
  }
  if (lcdForegroundColor != _lcdForegroundColorDefault) {
    r['lcdForegroundColor'] = lcdForegroundColor;
  }
  return r;
}