flutter_readium_platform_interface 0.0.1 copy "flutter_readium_platform_interface: ^0.0.1" to clipboard
flutter_readium_platform_interface: ^0.0.1 copied to clipboard

Platform interface for the flutter_readium plugin. Provides shared Dart models, the method-channel contract, and the reader API surface used by native implementations.

example/README.md

flutter_readium_platform_interface example #

This package is the platform interface for flutter_readium. End users should depend on flutter_readium directly — the snippets here are for plugin authors who want to add a new platform implementation, or for code that consumes the shared models / streams.

Implementing a new platform #

A platform implementation should extend FlutterReadiumPlatform and register itself as the active instance during plugin initialisation.

import 'package:flutter_readium_platform_interface/flutter_readium_platform_interface.dart';

class FlutterReadiumExample extends FlutterReadiumPlatform {
  @override
  Future<Publication> openPublication(String pubUrl) async {
    // Delegate to a native channel, an HTTP fetch, an in-memory mock, …
    return Publication(
      links: const [],
      metadata: Metadata(
        localizedTitle: LocalizedString.fromStrings({'en': 'Example Publication'}),
      ),
      readingOrder: const [],
    );
  }

  @override
  Future<void> closePublication() async {}

  // Override the remaining members of FlutterReadiumPlatform as required.
}

void registerExample() {
  FlutterReadiumPlatform.instance = FlutterReadiumExample();
}

Working with the shared models #

All models expose hand-written toJson / fromJson so they can be sent across a method channel or persisted without code generation.

import 'package:flutter_readium_platform_interface/flutter_readium_platform_interface.dart';

final locator = Locator(
  href: '/chapter-1.xhtml',
  type: 'application/xhtml+xml',
  locations: Locations(progression: 0.42, totalProgression: 0.17),
);

final encoded = locator.toJson();
final decoded = Locator.fromJson(encoded);

assert(decoded.href == locator.href);

See the project repository for the full reader API, an end-to-end example app, and documentation.

0
likes
150
points
173
downloads

Documentation

API reference

Publisher

verified publisherkb.dk

Weekly Downloads

Platform interface for the flutter_readium plugin. Provides shared Dart models, the method-channel contract, and the reader API surface used by native implementations.

Repository (GitHub)
View/report issues
Contributing

Topics

#readium #ebook #audiobook #comic #tts

License

BSD-3-Clause (license)

Dependencies

collection, crypto, dartx, dfunc, equatable, flutter, logging, meta, path, plugin_platform_interface

More

Packages that depend on flutter_readium_platform_interface