The effect is not triggered in ranged combat (throwing weapon) only in melee combat, but the description does not say otherwise:
https://baldursgate3.wiki.fextralife.com/Fly+TrapEither the effect is buggy or the description must explicitly mention that Fly Trap is only available in melee combat.
In general, all melee weapons with effects should have a note in the description that the effect is also only available for melee and not as a throwing weapon if it is intended to be so...
I agree on hit effects should apply when thrown, as long as the weapon has the "Thrown" property. My assumption has always been that if a weapon isn't a throwing one, then its on hit effects, along with its normal attack stats, don't apply. But I guess there could be an argument that they should. Hmm, I could be persuaded either way I think. Is this something 5e has a ruling on?
Last time I used this the Fly Trap ability even triggered on a miss. Super crazy weapon can restrain on any attack, even a miss.
Did it? It's a while since I used it, but it does seem that the fly trap effect should only apply if your attack hits!