ChapterNode class

Represents a chapter or subchapter in the EPUB table of contents.

This class supports arbitrary nesting depth, allowing proper representation of complex EPUB structures with chapters, subchapters, sub-subchapters, etc.

Constructors

ChapterNode({required String title, required int startIndex, int depth = 0, List<ChapterNode> children = const [], String? contentFileName, String? anchor})
const
ChapterNode.fromJson(Map<String, dynamic> json)
Create from JSON.
factory

Properties

anchor → String?
The anchor within the content file (for internal use).
final
children → List<ChapterNode>
Child chapters (subchapters of this chapter).
final
contentFileName → String?
The content file name in the EPUB (for internal use).
final
depth → int
The depth level (0 = top-level chapter, 1 = subchapter, etc.)
final
hasChildren → bool
Whether this chapter has subchapters.
no setter
hashCode → int
The hash code for this object.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
startIndex → int
The starting paragraph index in the flattened content.
final
title → String
The title of this chapter.
final
type → String
The type identifier (for compatibility).
no setter

Methods

copyWith({String? title, int? startIndex, int? depth, List<ChapterNode>? children, String? contentFileName, String? anchor}) → ChapterNode
Create a copy with modified properties.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Convert to JSON for serialization.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override