serveLocalAssets method
- Language language
For serving the reader assets locally.
Implementation
Future<LocalAssetsServer> serveLocalAssets(Language language) async {
int port = getPortForLanguage(language);
if (_lastServeFailed) {
await Future.delayed(const Duration(seconds: 1));
}
try {
_lastServeFailed = false;
final server = LocalAssetsServer(
address: InternetAddress.loopbackIPv4,
port: port,
assetsBasePath: 'assets/ttu-ebook-reader',
logger: const DebugLogger(),
);
await server.serve();
return server;
} catch (e) {
_lastServeFailed = true;
rethrow;
}
}