Serialize common base fields to a map.
Map<String, dynamic> baseToJson() => { 'blockId': blockId, 'type': type.name, 'index': index, if (style != null) 'style': style, };