Flushing rules forces them to be rebuilt from whatever is currently registered, so you should register post types before flushing.
This is why you must register your post types in a plugin activation hook as well as on init, otherwise your rules won’t exist on subsequent requests if you’re flushing on activation.