updateListTemplateSections method

Future<void> updateListTemplateSections({
  1. required String elementId,
  2. required List<CPListSection> sections,
})

It will update the sections of the CPListTemplate which has the given elementId.

Implementation

Future<void> updateListTemplateSections({
  required String elementId,
  required List<CPListSection> sections,
}) async {
  final bool? isCompleted =
      await FlutterCarPlayController.flutterToNativeModule(
    FCPChannelTypes.updateListTemplateSections,
    <String, dynamic>{
      'elementId': elementId,
      'sections':
          sections.map((CPListSection section) => section.toJson()).toList(),
    },
  );

  if (isCompleted == true) {
    final template =
        FlutterCarPlayController.getTemplateFromHistory<CPListTemplate>(
            elementId);
    template?.updateSections(sections);
  }
  return;
}