All a bit strange, because saving a form state comes as standard.
Simply study the form streaming mechanism, which is what you want.
Also note your own properties can have the stored modifier.
Storing form state dates even from Delphi 1.
There are multiple examples, also for Lazarus and on this forum, on how to do that.
It is basic..... and some of the answers are simply annoying.
Any component state can be saved for its published properties by just using the provided streaming mechanisims.
Of course reading back simply uses the same mechanism.
Again, all of this is plain standard Lazarus-Delphi standard.