If you are using PlatformIO, then you are using the Arduino BSP, it is just called nRF52 Platform there.
I do not have a simple example how to store variables in the flash (in this case using the file system of the nRF52 platform), but you can have a look into flash-nrf52.cpp
There are functions to
initialize the file system and read a data structure from it
check if the structure is valid
write a default structure if the data is invalid
have a function to save a data structure to the file system
As this is saved in flash, it is persistence over resets and power cycles.