Source: Starfinder Core Rulebook p.122
You can cast an area spell with a casting time of 1 standard action or less through a ranged weapon, allowing you to use the weapon's range rather than the spell's range. You must target a single creature with your attack, and the spell's area is centered on that creature, or originates at the creature's location for a cone or line effect (oriented in whichever direction you choose), even if the spell would normally be centered on or originate from a point. You can fire the weapon as part of the standard action to cast the spell. You must fire the weapon during the round that the casting is completed, or the spell is wasted. If the attack misses, the spell is wasted. Spells with an emanation effect that would be centered on you don't benefit from this magic hack.