requestPermission method
This is required on iOS 13+ to retrieve data from the gyroscope. It only works if it is called after a user interaction.
If you set autoRequestAccelerometerPermission
in the AppConfig to true it will
automatically handled on first user interaction
Implementation
Future<bool> requestPermission() async {
var completer = Completer<bool>();
if (Platform.isIOS()) {
try {
var permissionState = await (_requestPermission().toDart);
completer.complete(permissionState.toDart == 'granted');
window.addEventListener('devicemotion', _onDeviceMotion.toJS);
} catch (e) {
warn("Accelerometer Permissions not granted", e.toString());
completer.complete(false);
}
} else {
window.addEventListener('devicemotion', _onDeviceMotion.toJS);
completer.complete(true);
}
return completer.future;
}