executeUikWidgetAction function

dynamic executeUikWidgetAction(
  1. UikAction? uikAction,
  2. BuildContext? context
)

Implementation

executeUikWidgetAction(UikAction? uikAction, BuildContext? context) async {
  if (uikAction != null) {
    if (uikAction.tap.type.startsWith("UIK")) {
      UikActionType tapAction = UikActionType.values.firstWhere(
          (e) => e.toString() == "UikActionType." + uikAction.tap.type);
      switch (tapAction) {
        case UikActionType.UIK_OPEN_WEB:
          launchURL(uikAction.tap.data.url);
          break;
        default:
          break;
      }
    } else {
      if (context != null) {
        var cubit = context.read<ApiResponseCubit>();
        cubit.state.actionFunction(uikAction);
      }
    }
  }
}