flutter_epub_viewer
2.2.1, released 3 weeks ago by fayis.dev
A Flutter widget that displays EPUB books using a WebView and epub.js.
WASM-ready
What it does
It renders EPUB files inside a WebView, providing pagination, search, highlights, footnotes, and theme support. The widget tracks reading progress and allows navigation via a controller.
AI-written summary of version 2.2.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to show EPUB documents on Android, iOS, macOS, or Web.
- You want built‑in features like search, highlights, and progress tracking without writing your own renderer.
Skip it when
- You cannot use a WebView (e.g., strict size constraints or platform restrictions).
- You need support for formats other than EPUB or require a fully native rendering engine.
Strengths
- Cross‑platform (Android, iOS, macOS, Web).
- Leverages mature epub.js for accurate EPUB rendering.
- Built‑in navigation, search, highlights, and theming.
- Improved performance with local server loading.
Weaknesses
- Depends on a WebView, increasing app size.
- Limited to EPUB format only.
- Requires platform‑specific permissions and entitlements.
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 3
Add INTERNET permission in AndroidManifest.xml if loading from network; add macOS entitlements for network server/client; no extra build steps required.
import 'package:flutter/material.dart';
import 'package:flutter_epub_viewer/flutter_epub_viewer.dart';
class ReaderPage extends StatefulWidget {
const ReaderPage({super.key});
@override
State<ReaderPage> createState() => _ReaderPageState();
}
class _ReaderPageState extends State<ReaderPage> {
final controller = EpubController();
double progress = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('${(progress * 100).round()}%')),
body: SafeArea(
child: EpubViewer(
epubController: controller,
epubSource: EpubSource.fromAsset('assets/book.epub'),
onRelocated: (loc) => setState(() => progress = loc.progress),
),
),
);
}
}
Alternatives
Packages that do the same job and could replace flutter_epub_viewer.
Works with
Packages commonly used together with flutter_epub_viewer: ones it builds on, ones built on it, and its own family.