FlashIAP.h flash.get_flash_size()

Hi
Im working through the "https://docs.arduino.cc/tutorials/portenta-h7/reading-writing-flash-memory" example except i am coding with VS Code and PlatformIO.

My include file "FlashIAPLimits.h" wont complie at the line:

flash_size = flash.get_flash_size();

condensed version of FlashIAPLimits.h is:

// An helper struct for FlashIAP limits
struct FlashIAPLimits {
  size_t flash_size;
  uint32_t start_address;
  uint32_t available_size;
}
// Get the actual start address and available size for the FlashIAP Block Device
// considering the space already occupied by the sketch (firmware).
FlashIAPLimits getFlashIAPLimits()
{
 
  size_t flash_size;
  uint32_t flash_start_address;
  uint32_t start_address;
  FlashIAP flash;

  auto result = flash.init();
  if (result != 0)
    return { };

  // Find the start of first sector after text area
  int sector_size = flash.get_sector_size(FLASHIAP_APP_ROM_END_ADDR);
  start_address = flash.align_up(FLASHIAP_APP_ROM_END_ADDR, sector_size);
  flash_start_address = flash.get_flash_start();
  flash_size = flash.get_flash_size();

When in inspect "FlashIAP.h" i see that "get_flash_size" is typedef uint32_t

  /** Get the flash size
     *
     *  @return Flash size
     */
    uint32_t get_flash_size() const;

When i edit "FlashIAPLimits.h" so that flash_size is a uint32_t it also wont complie. can someone please guide me here?