Map<String, Object?> toJson() => { 'contents': contents.toJson(), if (range != null) 'range': range!.toJson(), };