Skip to main content
The Portal interface represents a content source portal that provides access to books and chapters. Each portal implementation must provide configuration, branding, and a service instance.

Interface definition

abstract interface class Portal<T extends PortalSettings> {
  String get url;
  String get name;
  String get code;
  PortalLogo get logo;
  PortalService<T> get service;
}

Properties

url
String
required
The base URL of the portal.
name
String
required
The display name of the portal.
code
String
required
A unique identifier code for the portal.
The logo configuration for the portal, including asset path and optional package name.
service
PortalService<T>
required
The service instance that handles all portal operations like fetching books and chapters.
The PortalLogo class defines the branding assets for a portal.
final class PortalLogo {
  const PortalLogo({required this.assetPath, this.packageName});

  final String assetPath;
  final String? packageName;
}

Properties

assetPath
String
required
The path to the logo asset file.
packageName
String?
Optional package name where the asset is located.

Usage example

class MyPortal implements Portal<MyPortalSettings> {
  @override
  String get url => 'https://example.com';
  
  @override
  String get name => 'Example Portal';
  
  @override
  String get code => 'example';
  
  @override
  PortalLogo get logo => const PortalLogo(
    assetPath: 'assets/logo.png',
    packageName: 'my_portal_package',
  );
  
  @override
  PortalService<MyPortalSettings> get service => MyPortalService();
}

Type parameters

T
PortalSettings
The settings type for this portal, must extend PortalSettings.

Build docs developers (and LLMs) love