@override Object toJson() => { 'parent': parent, 'viewId': viewId, if (view case final view?) 'view': view.toJson(), };