epub_package 0.0.3-beta3

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 64

epub_package #

Yet another EPub package for Flutter.

Why another EPUB package? #

You may already noticed, there is an awesome epub package on pub that works for all dart platforms. Why I created another EPub package only for Flutter?

Here is the story:

When I started my 2nd experimental Flutter project which is a reader for EPub, I immediately installed epub package. Soon I realized the package depends on archive to handle ZIP format. Everything was fine until I found I have a huge EPub file which is over 120MiB. It requires a lot of memory because archive has to read all data into memory. That's unacceptable to a mobile app.

And here we are. This package also has implemented a very simple reader requires 16KiB memory buffer to parse Zip files.

According to a fantastic answer from stackoverflow:

The ISO/IEC 21320-1:2015 standard for file containers is a restricted zip format, such as used in Java archive files (.jar), Office Open XML files (Microsoft Office .docx, .xlsx, .pptx), Office Document Format files (.odt, .ods, .odp), and EPUB files (.epub). That standard limits the compression methods to 0 and 8, as well as other constraints such as no encryption or signatures.

My implementation is just good enough for EPub files.

Another issue I noticed later was the disk speed of some devices. My low-price Android phone from 2016 spends ~10s to parse the Zip file. Unfortunately, Zip format just bundles files one by one. There is no a single block to hold all files information. That means the internal storage has only ~10M/s reading speed. No wonder it's cheap! Even the files had just been read, it still required 4s+. So I had to find a way to avoid parse large files every time. That's why I introduced another functionality to load from json when it's unchanged.

So this is basically an EPub reader with small memory consumption.

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

Change Log #

[0.0.3-beta3] - Released on 2019-01-19

  • Added mediaType to EpubDocument
  • Support extract raw zip data so web service can directly serve Content-Encoding: deflate

[0.0.2-beta2]

  • Some bug fixes

[0.0.1-beta1] - Basic functionalities

  • Main functionalities are finished and need to be tested.
  • Added some documents to source files.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  epub_package: ^0.0.3-beta3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:epub_package/epub_package.dart';
  
Version Uploaded Documentation Archive
0.0.3-beta3 Jan 19, 2019 Go to the documentation of epub_package 0.0.3-beta3 Download epub_package 0.0.3-beta3 archive
0.0.2-beta2 Jan 7, 2019 Go to the documentation of epub_package 0.0.2-beta2 Download epub_package 0.0.2-beta2 archive
0.0.1-beta1 Dec 9, 2018 Go to the documentation of epub_package 0.0.1-beta1 Download epub_package 0.0.1-beta1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
40
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Jun 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.2
  • pana: 0.12.18

Platforms

Detected platforms: Flutter, other

Primary library: package:epub_package/epub_package.dart with components: io.

Health suggestions

Fix lib/epub/epub_package.dart. (-0.50 points)

Analysis of lib/epub/epub_package.dart reported 1 hint:

line 208 col 7: DO use curly braces for all flow control structures.

Fix lib/zip/zip_package.dart. (-0.50 points)

Analysis of lib/zip/zip_package.dart reported 1 hint:

line 88 col 7: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Maintenance issues and suggestions

Support latest dependencies. (-15 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (1 direct: html).

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and epub_package.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
html ^0.13.3+3 0.13.4+2 0.14.0+2
mime ^0.9.6+2 0.9.6+3
path ^1.6.2 1.6.2
xml ^3.2.5 3.5.0
Transitive dependencies
charcode 1.1.2
collection 1.14.11
convert 2.1.1
csslib 0.15.0 0.16.0
petitparser 2.3.0
source_span 1.5.5
term_glyph 1.1.0
typed_data 1.1.6
utf 0.9.0+5
Dev dependencies
test ^1.5.1