How to run flush_rewrite_rules on activation after i register my custom post type using WordPress Boilerplate Plugin

After a couple of days trying and trying and trying… i asked a youtuber who develops using the same WordPress Plugin Boilerplate and he pointed me to this article:

https://andrezrv.com/2014/08/12/efficiently-flush-rewrite-rules-plugin-activation/

It adds an option inside_option table and it will flush rewrite rules based on that 🙂
It worked perfectly