handleMethodCall method
Handles method calls over the MethodChannel of this plugin. Note: Check the "federated" architecture for a new way of doing this: https://flutter.dev/go/federated-plugins
Implementation
Future<dynamic> handleMethodCall(MethodCall call) async {
switch (call.method) {
case 'hasVibrator':
return Future.value(_hasVibrator());
case 'vibrate':
final int duration = call.arguments['duration'];
final List<int> pattern = call.arguments['pattern'].cast<int>();
return Future.value(_vibrate(duration: duration, pattern: pattern));
case 'hasAmplitudeControl':
case 'hasCustomVibrationsSupport':
return Future.value(false);
case 'cancel':
return Future.value(_cancel());
default:
throw PlatformException(
code: 'Unimplemented',
details: 'vibration_web doesn\'t implement \'${call.method}\'',
);
}
}