requestCamera static method

Future<bool> requestCamera()

Requests camera permission. Returns true once the OS has reported authorized; false if the user denied or the platform is unsupported. Safe to call multiple times — already-granted returns true immediately.

Implementation

static Future<bool> requestCamera() async {
  if (defaultTargetPlatform != TargetPlatform.iOS &&
      defaultTargetPlatform != TargetPlatform.android) {
    return false;
  }
  final granted = await _channel.invokeMethod<bool>('requestPermission');
  return granted ?? false;
}