ObjectData.fromJson constructor
Creates an ObjectData from a JSON map.
Implementation
factory ObjectData.fromJson(Map<String, dynamic> json) {
return ObjectData(
uuid: json['uuid'] as String? ?? '',
position: Position.fromJson(json['position'] as Map<String, dynamic>? ?? {}),
category: ObjectCategory.fromJson(json['category'] as String? ?? 'unknown'),
width: (json['width'] as num?)?.toDouble() ?? 0.0,
height: (json['height'] as num?)?.toDouble() ?? 0.0,
length: (json['length'] as num?)?.toDouble() ?? 0.0,
confidence: Confidence.fromJson(json['confidence'] as String? ?? 'low'),
dimensions: json['dimensions'] != null
? RoomDimensions.fromJson(json['dimensions'] as Map<String, dynamic>)
: null,
transform: json['transform'] != null
? _matrixFromJson(json['transform'] as List<dynamic>)
: null,
);
}