showtoast: how to test if a method is supported on a device

I am using the methods showToast with Fenix 5 to 7. Unfortunately, the method is not supported on Fenix 5 and creates a crash. 

I tried:

if ($ has :showToast) {showToast("Acquiring position",null);}

But no toasts are displayed for all Fenix.

Any idea?

Thank you