itemAction method

void itemAction(
  1. String feedId,
  2. PluginAction declaration,
  3. PanelActionHandler run
)

Declares a command offered on one event of feedId rather than on the panel — explain on the query the user clicked.

The event's id arrives in the arguments as event, which is what lets a handler reach the details the ring is holding for it.

Implementation

void itemAction(
  String feedId,
  PluginAction declaration,
  PanelActionHandler run,
) {
  var feed = _feeds[feedId];
  if (feed == null) {
    throw ArgumentError(
      'panel $id has no feed "$feedId". Declare the feed before its '
      'actions. Declared: ${_feeds.keys.toList()}',
    );
  }
  _claimMethod(declaration.id);
  _feeds[feedId] = FeedDescriptor(
    feed.id,
    feed.label,
    description: feed.description,
    fields: feed.fields,
    durationKey: feed.durationKey,
    itemActions: [...feed.itemActions, declaration],
  );
  _handlers[declaration.id] = run;
  _core.registerHandler(id, declaration.id, run);
  _panels._changed();
}