getActions method

Future<List<FCXAction>> getActions()

The list of actions contained by the transaction.

Implementation

Future<List<FCXAction>> getActions() async {
  try {
    String method = 'getActions';
    var data = await _methodChannel.invokeListMethod<Map>(
      '$_TRANSACTION.$method',
      {'transactionUuid': uuid},
    );
    _FCXLog._i(runtimeType, method);
    List<FCXAction> actions = [];
    if (data == null) {
      _FCXLog._w(runtimeType, 'Empty data received, processing skipped');
    } else {
      for (Map map in data) {
        FCXAction? action = _FCXActionMapDecodable._makeAction(map);
        if (action == null) {
          _FCXLog._w(runtimeType, 'failed to decode action: $map');
        } else {
          actions.add(action);
        }
      }
    }
    return actions;
  } on PlatformException catch (e) {
    var exception = FCXException(e.code, e.message);
    _FCXLog._e(runtimeType, exception);
    throw exception;
  }
}