updateCPListImageRowItem static method

void updateCPListImageRowItem(
  1. CPListImageRowItem updatedListImageItem
)

Implementation

static void updateCPListImageRowItem(
  CPListImageRowItem updatedListImageItem,
) {
  flutterToNativeModule(
    FCPChannelTypes.updateListImageRowItem,
    updatedListImageItem.toJson(),
  ).then(
    (value) {
      if (value != true) return;

      for (var h in templateHistory) {
        switch (h) {
          case CPTabBarTemplate _:
            for (var t in h.templates) {
              if (t is CPListTemplate) {
                for (var s in t.sections) {
                  for (var i in s.items) {
                    if (i.uniqueId == updatedListImageItem.uniqueId &&
                        i is CPListImageRowItem) {
                      s.items[s.items.indexOf(i)] = updatedListImageItem;
                      return;
                    }
                  }
                }
              }
            }
            break;
          case CPListTemplate _:
            for (var s in h.sections) {
              for (var i in s.items) {
                if (i.uniqueId == updatedListImageItem.uniqueId &&
                    i is CPListImageRowItem) {
                  s.items[s.items.indexOf(i)] = updatedListImageItem;
                  return;
                }
              }
            }
            break;
          default:
        }
      }
    },
  );
}