benjamindean / flutter_vibration

Handle vibration on iOS and Android in Flutter apps
219 stars 68 forks source link

bool operator for hasVibrator #23

Closed nicolasvahidzein closed 4 years ago

nicolasvahidzein commented 4 years ago

i get an error when i try this:

               if (Vibration.hasVibrator()) {
                Vibration.vibrate(duration: 500);
                return true;
        }

saying

Conditions must have a static type of 'bool'. Try changing the condition.

benjamindean commented 4 years ago

All the methods are Futures. Meaning, you should await them. You can always check it by checking the function return type. I released a new version with updated README.

nicolasvahidzein commented 4 years ago

Ok Benjamin, thanks. Will try that now.