startScanning method

Future<ScanResult?> startScanning()

Opens the native capture interface and returns the final room scan.

Returns null when the capture is cancelled.

Implementation

Future<ScanResult?> startScanning() async {
  _ensureOpen();
  final payload = await _channel.startRoomCapture();
  if (payload == null) return null;
  if (payload is! String) {
    throw const FormatException('RoomPlan returned an invalid scan result.');
  }
  final result = parseScanResult(payload);
  if (result == null) {
    throw const FormatException('RoomPlan returned unreadable scan data.');
  }
  return result;
}