CommunicationApi class
Offers an API for all plugins to access the local toolbox.
Constructors
- CommunicationApi(String executor, String id, bool isMaster, Declaration declaration, {String? statePath, StorageMapper mapper() = defaultStorageMapper, bool autoAcceptRegistration = true, bool ignoreMessageSignature = false})
- Creates a CommunicationApi with the given executor and plugin id.
Properties
- autoAcceptRegistration → bool
-
final
- declaration → Declaration
-
Data sharing Declaration.
final
- executor → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Identifier of plugin.
final
- ignoreMessageSignature → bool
-
final
- isMaster → bool
-
final
-
All registered
MenuItem
s mapped by their path.final - platform → MethodChannel
-
final
-
plugins
→ StorableHashMap<
StorableString, PluginInformation> -
PluginInformation
of all registered plugins mapped by their id.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- starting ↔ bool
-
getter/setter pair
- statePath ↔ String?
-
getter/setter pair
- storage ↔ StorageController
-
StorageController
to access the master storage.latefinaloverride-getter
Methods
-
activatePlugin(
) → Future< void> - Mark this plugin as active on the master.
- Authorize the plugin.
-
broadcastMessage(
Message message) → Future< void> -
Broadcasts a
message
to all known plugins. -
close(
) → Future< void> -
Release all resources.
override
-
deactivatePlugin(
) → Future< void> - Mark this plugin as deactivated on the master.
-
deregisterListener(
List< MessageType> ? events, PluginListener listener) → void -
Remove the
listener
from specificevents
locally.override -
deregisterMenu(
→ Future< )void> -
Removing a menu entry
menuId
from th toolbox core. -
deregisterPlugin(
[String? pluginId]) → Future< void> - Unregisters an already registered plugin in the toolbox.
-
disableMenu(
→ Future< )void> -
Disable a previously registered
menuId
. -
enableMenu(
→ Future< )void> -
Enable a previously registered
menuId
. -
getMenuList(
) → List< MenuItem> -
Get a list of all registered MenuItems.
override
-
getRegisteredPlugins(
[String? startId]) → Future< List< PluginInformation> > - Get the PluginInformation of all registered plugins.
-
getStorage(
) → StorageController -
Retrieve the
StorageController
to access the master storage.inherited -
initialize(
) → Future< void> -
Initialize asynchronous parts of the plugin.
override
-
Notify plugin about a MenuItem with a specific
url
being pressed.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
receivedMessage(
Message msg, {bool skipAuth = false}) → Future< void> -
registerListener(
List< MessageType> events, PluginListener listener) → void -
Register the
listener
for specificevents
locally.override -
registerMenu(
→ Future< )void> -
Register a menu entry
menu
in the toolbox core. -
registerPlugin(
) → Future< void> - Registers the plugin to the toolbox framework.
-
restoreState(
) → Future< void> -
scanButtonPressed(
) → Future< void> -
Notify all plugins that the scan button was pressed.
override
-
sendMessage(
Message message, [String? pluginId, PluginInformation? plugin]) → Future< void> -
Send a
message
to a anotherplugin
.override -
sendMessageDirect(
Message message, [String? pluginId, PluginInformation? plugin]) → Future< void> -
Send a
message
to a anotherplugin
without waiting for previous dispatches to finish.override -
storeState(
) → Future< void> -
toString(
) → String -
A string representation of this object.
inherited
-
zapState(
) → Future< void> -
Reset the GeigerApi by removing all registered plugins and MenuItems.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
defaultStorageMapper(
) → StorageMapper -
Default
StorageMapper
generator used by the master.
Constants
- masterStartWaitTime → const Duration
- Duration non-master plugins will wait for the master to start.
- maxSendTries → const int
- Maximum number of times a message gets resend when a newly started plugin won't respond.