updateInformationTemplateItems method

Future<void> updateInformationTemplateItems({
  1. required String elementId,
  2. required List<CPInformationItem> items,
})

It will update the information items of the CPInformationTemplate which has the given elementId.

Implementation

Future<void> updateInformationTemplateItems({
  required String elementId,
  required List<CPInformationItem> items,
}) async {
  final bool? isCompleted =
      await FlutterCarPlayController.flutterToNativeModule(
    FCPChannelTypes.updateInformationTemplateItems,
    <String, dynamic>{
      'elementId': elementId,
      'items': items.map((CPInformationItem item) => item.toJson()).toList(),
    },
  );

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