The documentation you are viewing is for an older version of this component.
Switch to the latest (v4) version.
Run the following command in your project folder
composer require dotkernel/dot-flashmessenger
This will also install laminas/laminas-session as session handling is based on this library.