Sure, here's the fixed markdown:
Flutter Accessory Kit

At this stage the library supports:
xBLEWiFi (work in progress)Migration
âŧī¸ One important remark: by Apple's design, the library works only with iOS 18 or above. âŧī¸
đ How to use
Install the library using the command line:
flutter pub get flutter_accessorysetup
âī¸ Setup
-
You should add the keys to the Info.plist of the iOS app to make it work. â ī¸ If you miss the required key the app will crash when you show the picker. â ī¸
- ALWAYS: (Bluetooth or WiFi, or both)
<key>NSAccessorySetupKitSupports</key> <array> <string>Bluetooth</string> <string>WiFi</string> </array>- When you use the
ASDiscoveryDescriptorwithbluetoothServiceUUID
â ī¸ The UUID string must be upper-cased here. â ī¸
<key>NSAccessorySetupBluetoothServices</key> <array> <string>149E9E42-33AD-41AD-8665-70D153533EC1</string> </array>- When you use the
ASDiscoveryDescriptorwithbluetoothNameSubstring
â ī¸ Does not work in the iOS 18 Developer beta 2. â ī¸
<key>NSAccessorySetupBluetoothNames</key> <array> <string>DeviceName</string> </array>- There is an option with manufacturer ID that is not covered here.
-
Use the
FlutterAccessorysetupclass. See the full code example in the Example app
final _flutterAccessorysetupPlugin = FlutterAccessorysetup();
_flutterAccessorysetupPlugin.sessionStream.listen((event) => setState(() {
// handle session events here
// async errors will be delivered as session events too
}));
try {
await _flutterAccessorysetupPlugin.activate();
await _flutterAccessorysetupPlugin.showPicker();
} on PlatformException {
debugPrint('Failed to show the picker');
}
âšī¸ What we know
â ī¸ The AccessorySetup does not work on the Simulator. â ī¸
-
When the user closes the Picker by tapping the cross button, the
showPickerclosure emits an error (ASErrorDomain, code 700). -
â ī¸ When the person picks a BLE accessory, the picker sends an event of type
ASAccessoryEventType.accessoryChanged. It might be that the picker sends an event of typeASAccessoryEventType.accessoryAdded, but I can't reproduce it at all. â ī¸ -
If the device has been connected previously, it will be in the
session.accessoriesarray right after the session is activated.
â ī¸ This device will not be discoverable by the Setup Picker until the user disconnects it from the settings. â ī¸ -
When the user selects the device using the picker:
- The device will be displayed in the
My Devicessection of theSettings/Bluetoothscreen. - The device's info screen will display the image and name you provided to the
ASPickerDisplayItemduring the discovery process (the same that the user saw in the picker).
- The device will be displayed in the
-
When the user deletes the app, the device will be disconnected automatically. It won't be displayed in the
My Devicessection of theSettings/Bluetoothscreen anymore.