RegisterDefinition.fromJson constructor
Create from JSON map.
Implementation
factory RegisterDefinition.fromJson(Map<String, dynamic> json) {
return RegisterDefinition(
name: json['name'] as String,
address: json['address'] as int,
type: RegisterType.values.byName(json['type'] as String),
dataType: json['dataType'] != null
? DataType.values.byName(json['dataType'] as String)
: DataType.uint16,
quantity: json['quantity'] as int?,
byteOrder: json['byteOrder'] != null
? ByteOrder.values.byName(json['byteOrder'] as String)
: ByteOrder.bigEndian,
multiplier: json['multiplier'] != null ? (json['multiplier'] as num).toDouble() : null,
offset: json['offset'] != null ? (json['offset'] as num).toDouble() : null,
unit: json['unit'] as String?,
description: json['description'] as String?,
readOnly: json['readOnly'] as bool? ?? false,
);
}