Config.fromJson constructor
Config.fromJson(
- Map json
Creates Config from json
Implementation
factory Config.fromJson(Map json){
return $checkedCreate(
'Config',
json,
($checkedConvert) {
final val = Config(
sofDeviceReqType: $checkedConvert('softdevice_type', (v) => v as String? ?? 's132NRF52d611'),
debug: $checkedConvert('debug', (v) => v as bool? ?? false),
hardwareVersion: $checkedConvert('hardware_version', (v) => v as int? ?? 0xFFFFFFFF),
comment: $checkedConvert('comment', (v) => v as String?),
exportPath: $checkedConvert('export_path', (v) => v as String? ?? ''),
softdeviceConfig: $checkedConvert('softdevice',
(v) => v == null ? const SoftDeviceConfig() : SoftDeviceConfig.fromJson(v as Map)),
applicationConfig: $checkedConvert('application',
(v) => v == null ? const ApplicationConfig() : ApplicationConfig.fromJson(v as Map)),
bootloaderConfig: $checkedConvert('bootloader',
(v) => v == null ? const BootloaderConfig() : BootloaderConfig.fromJson(v as Map)),
keyfileConfig: $checkedConvert('keyfile',
(v) => v == null ? null : KeyFileConfig.fromJson(v as Map)),
settingsConfig: $checkedConvert('settings',
(v) => v == null ? null : SettingsConfig.fromJson(v as Map)),
);
return val;
},
fieldKeyMap: const {
'sofDeviceReqType': 'softdevice_type',
'comment': 'comment',
'exportPath': 'export_path',
'softdeviceConfig': 'softdevice',
'applicationConfig': 'application',
'bootloaderConfig': 'bootloader',
'keyfileConfig': 'keyfile',
'settingsConfig': 'settings',
'hardwareVersion': 'hardware_version',
},
);
}