Skip to main content
Klyx provides services to extensions through property delegates and context functions. Services fall into two categories: global PluginService instances shared across all plugins, and per-plugin PluginRuntimeService instances scoped to your plugin.

Plugin services (global)

Global services are singletons shared across all plugins. Access them with by plugin():
These delegates use Koin internally and resolve the service at first access. They work from anywhere in your KlyxPlugin implementation, including init blocks. When you access Logger via by plugin(), Klyx automatically wraps it in a PluginLogger that tags log entries with your plugin’s name. This means you do not need to specify a tag manually.

Runtime services (per-plugin)

Runtime services are unique to your plugin instance. Access them with by runtime():
PluginInfo gives you access to the plugin descriptor and file paths:

PluginContext

The PluginContext gives your plugin access to the core application and runtime services:

Resolving services from PluginContext

You can resolve services inline from a PluginContext:

The event bus

The event bus is accessed through the plugin context:

Plugin resources

The PluginContext.context is an Android Context backed by the plugin’s own APK resources. Use withResources to make Compose resource lookups resolve against the plugin:

Coroutine context access

Within a plugin’s coroutine scope, access services through the current coroutine context:
Available functions:

Complete service list