updateInformationTemplateActions method

Future<void> updateInformationTemplateActions({
  1. required String elementId,
  2. required List<CPTextButton> actions,
})

It will update the actions of the CPInformationTemplate which has the given elementId.

Implementation

Future<void> updateInformationTemplateActions({
  required String elementId,
  required List<CPTextButton> actions,
}) async {
  final bool? isCompleted =
      await FlutterCarPlayController.flutterToNativeModule(
    FCPChannelTypes.updateInformationTemplateActions,
    <String, dynamic>{
      'elementId': elementId,
      'actions':
          actions.map((CPTextButton action) => action.toJson()).toList(),
    },
  );

  if (isCompleted == true) {
    final template = FlutterCarPlayController.getTemplateFromHistory<
        CPInformationTemplate>(elementId);
    template?.updateActions(actions);
  }
  return;
}