handle method

Future<Map<String, dynamic>> handle(
  1. String action,
  2. Map<String, dynamic> payload
)

Handles action with payload, returning the response payload.

A thrown OmnyStoreException is rendered into the payload rather than propagated, so the hub can reconstruct the original typed exception instead of receiving an opaque transport failure.

Implementation

Future<Map<String, dynamic>> handle(
  String action,
  Map<String, dynamic> payload,
) async {
  try {
    return await _dispatch(action, payload);
  } on OmnyStoreException catch (e) {
    return StoreProtocol.encodeException(e);
  }
}