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