run method

FutureOr<Object?> run(
  1. String actionId, [
  2. Map<String, Object?> args = const {}
])

Runs one of this panel's commands in process, without a wire.

The three methods below are what an in-app renderer calls — an overlay drawing this panel from its own descriptor. They are deliberately the same code the wire handlers run, because a second surface that re-implements the first is a second surface that can disagree with it: add a state, and the copy silently keeps serving the old shape.

Implementation

FutureOr<Object?> run(
  String actionId, [
  Map<String, Object?> args = const {},
]) {
  var handler = _handlers[actionId];
  if (handler == null) {
    throw ArgumentError(
      'panel $id has no action "$actionId". Declared: '
      '${_handlers.keys.toList()}',
    );
  }
  return handler(args);
}