Package selection guidance compiled from public package information, community data, and project usage.
Cosmos EPUB is a feature-rich Flutter package for reading EPUB files with smooth page flip animations, text highlighting, hyphenation, and support for infinite nested chapters. It handles images, RTL languages, and offers customizable themes and fonts. Ideal for building immersive reading apps with advanced formatting and accessibility features.
Use cases
Reading digital books in EPUB format
Building e-reader applications
Supporting multilingual and RTL text
Creating interactive educational content
Enabling text highlighting and annotations
Key features
Page flip animations
Text highlighting and hyphenation
Infinite nested chapter structure
Image and RTL language support
Customizable themes and fonts
Suitable for
E-book readers
Educational apps
Multilingual content platforms
Accessibility-focused applications
Customizable reading experiences
Considerations
Requires careful handling of large EPUB files
May need optimization for low-end devices
Limited to EPUB format only
Theme customization requires UI knowledge
Depends on external GitHub repository for updates
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
CosmosEpub 💫
A feature-rich EPUB reader package for Flutter with page flip animations, text highlighting, hyphenation, infinite nested chapters, image support, RTL languages, customizable themes and fonts.
Showcase
Features
Text Highlighting — select text, pick a color (6 options), highlights persist across sessions. Re-highlight to change color. Copy & Select All support.
Hyphenation — syllable-aware word breaking for better justified text. Visible "-" at line breaks. Respects Uzbek digraphs (ch, sh, g', o').
Infinite Nested Chapters — recursive TOC with unlimited depth. Section title pages auto-generated.
// From assetsawaitCosmosEpub.openAssetBook(
assetPath: 'assets/book.epub',
context: context,
bookId: 'my_book_1',
accentColor: Colors.indigoAccent,
onPageFlip: (currentPage, totalPages) {
print('Page $currentPage of $totalPages');
},
onLastPage: (lastPageIndex) {
print('Reached last page');
},
);
// From local fileawaitCosmosEpub.openLocalBook(
localPath: '/path/to/book.epub',
context: context,
bookId: 'my_book_2',
);
// From URLawaitCosmosEpub.openURLBook(
urlPath: 'https://example.com/book.epub',
context: context,
bookId: 'my_book_3',
);
// From bytesawaitCosmosEpub.openFileBook(
bytes: myUint8List,
context: context,
bookId: 'my_book_4',
);
Progress Management
// Get current progressBookProgressModel progress = CosmosEpub.getBookProgress('my_book_1');
print('Chapter: ${progress.currentChapterIndex}');
print('Page: ${progress.currentPageIndex}');
// Set progress manuallyawaitCosmosEpub.setCurrentChapterIndex('my_book_1', 5);
awaitCosmosEpub.setCurrentPageIndex('my_book_1', 3);
// Delete progressawaitCosmosEpub.deleteBookProgress('my_book_1');
awaitCosmosEpub.deleteAllBooksProgress();
Highlight Management
// Get all highlights for a bookList<HighlightModel> highlights = CosmosEpub.getBookHighlights('my_book_1');
// Remove a specific highlightCosmosEpub.removeHighlight(highlights.first.id);
// Remove all highlights for a bookCosmosEpub.removeAllHighlights('my_book_1');
Clear Theme Cache
awaitCosmosEpub.clearThemeCache();
Parameters
Parameter
Type
Default
Description
assetPath / localPath / urlPath / bytes
String / Uint8List
required
EPUB source
context
BuildContext
required
Build context for navigation
bookId
String
required
Unique ID for progress tracking
accentColor
Color
Colors.indigoAccent
Primary accent color
onPageFlip
Function(int, int)?
null
Called on page change
onLastPage
Function(int)?
null
Called on last page
chapterListTitle
String
'Table of Contents'
TOC screen title
shouldOpenDrawer
bool
false
Open TOC on start
starterChapter
int
-1
Start at specific chapter
RTL Language Support 🌍
Automatic detection and support for Right-to-Left languages:
Arabic (العربية), Persian (فارسی), Hebrew (עברית), Urdu (اردو)