---
name: ansight-migrate-sdk-1-1-flutter
description: Migrate a Flutter Android or iOS app from an older ansight_flutter pairing-config integration to SDK 1.1 zero-touch developer enrollment. Use when upgrading pub and native dependencies, deleting bundled pairing payload or host configuration, simplifying initialization, or adding generic physical-device QR enrollment behind a development guard.
---

# Migrate Flutter to Ansight SDK 1.1

Upgrade the Dart package and matching native packages, remove pairing payload
plumbing, and use native zero-touch enrollment.

## Migration

1. Inspect `pubspec.yaml`, `main.dart`, native projects, development guards,
   pairing environment variables, and existing scanner UI.
2. Upgrade the package:

```yaml
dependencies:
  ansight_flutter: 1.3.0-preview.10
```

```shell
flutter pub get
```

3. Remove bundled pairing JSON, pairing payload environment values, generated
   native resources, host and Wi-Fi settings, certificates, and build-time
   desktop-host probes.
4. Remove any startup configuration that passes the old pairing payload. Do
   not keep a compatibility fallback.
5. Initialize before `runApp(...)`:

```dart
WidgetsFlutterBinding.ensureInitialized();

if (kDebugMode) {
  await Ansight.instance.initializeAndActivate(AnsightOptions.developer());
  await AnsightFlutterInstrumentation.instance.install();
}
```

6. Add a developer-only physical-device action:

```dart
await Ansight.instance.enrollFromQrCode(
  clientName: "My Flutter App",
);
```

7. If the app already owns a scanner, use the payload connection API instead
   of adding another scanner.

## Native version alignment

Run dependency resolution for both native projects after the Dart package
upgrade. CocoaPods and Maven must resolve the matching
`1.3.0-preview.10` native artifacts rather than a stale lockfile version.

## Permissions

Android requires no app camera permission for the SDK scanner. On iOS, add
`NSCameraUsageDescription` for scanning and `NSLocalNetworkUsageDescription`
for direct device access. Add no ATS exception or unrelated permissions.

## Verification

Run:

```shell
flutter analyze
flutter test
```

Build the practical Android and iOS development targets. Verify automatic
emulator and Simulator enrollment, one generic QR scan per physical
installation, automatic reconnect after relaunch, and no developer tooling in
the intended distributable build.

Run `ansight pairing issue --qr` for physical enrollment and confirm
each target with `ansight session list --connected --app-id <app-id> --json`.
