get_post_types not working properly in admin

 add_action('admin_init', function(){
$post_types = get_post_types( array( 'public' => true ), 'names' ); 
var_dump($post_types);
});