Fetch sections

You can retrieve the blocks of the project with the function MBManager.shared.getSections() like this:

MBPaginatedResponse<MBSection> sections =
    await MBManager.shared.getSections(blockId: THE_BLOCK_ID);

The parameters value is an array of MBParameter objects as described in the previous section.

You can set the includeElements parameter to true if you want to include also the elements of the sections.

If you want to retrieve all the sections of a block and their elements you can call:

MBPaginatedResponse<MBSection> sections =
      await MBManager.shared.getSections(
      blockId: THE_BLOCK_ID,
      includeElements: true,
      );

Elements

If you include the elements, the propery elements of the section will be populated. The type of elements available are:

  • MBTextElement: represents a text

  • MBImagesElement: represents an image

  • MBMediaElement: a fille, audio, video or document

  • MBCheckboxElement: a checkbox

  • MBRelationElement: a relation between blocks

  • MBMarkdownElement: a markdown element

  • MBAddressElement: an address, with its coordinates

  • MBColorElement: a color

  • MBDateElement: a date

  • MBDropdownElement: a dropdown, with its possible values and the selected one

  • MBGeneralElement: a general element, returned when the type is not recognized

Last updated