StepEventMetadata.fromJson constructor

StepEventMetadata.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory StepEventMetadata.fromJson(Map<String, dynamic> json) {
  Map<String, PropertyDiff>? parsedDiff;
  final detailed = json['detailedDiff'];
  if (detailed is Map) {
    parsedDiff = <String, PropertyDiff>{};
    for (final entry in detailed.entries) {
      final value = entry.value;
      if (value is Map<String, dynamic>) {
        parsedDiff['${entry.key}'] = PropertyDiff.fromJson(value);
        continue;
      }
      if (value is Map) {
        parsedDiff['${entry.key}'] = PropertyDiff.fromJson(
          value.map((key, value) => MapEntry('$key', value)),
        );
      }
    }
  }

  return StepEventMetadata(
    op: json['op'] == null ? null : '${json['op']}',
    detailedDiff: parsedDiff,
  );
}