flutter_meta_wearables_dat_mock_device 0.7.1
flutter_meta_wearables_dat_mock_device: ^0.7.1 copied to clipboard
Optional MockDeviceKit add-on for flutter_meta_wearables_dat — simulate Meta glasses using the phone's camera for development and testing. Omit in production.
flutter_meta_wearables_dat_mock_device #
Optional MockDeviceKit add-on for flutter_meta_wearables_dat. Simulates a Ray-Ban Meta backed by the phone's camera so you can exercise pairing / registration / streaming without physical glasses.
Add this only in dev/staging builds. It vendors
MWDATMockDevice.xcframework(iOS) and depends onmwdat-mockdevice(Android), which linksAVFoundation/Camerasymbols. Production apps should pull in the core plugin alone so they don't have to declareNSCameraUsageDescription(iOS) or theCAMERApermission (Android) just to ship.
Setup #
# pubspec.yaml
dependencies:
flutter_meta_wearables_dat: ^0.7.0
flutter_meta_wearables_dat_mock_device: ^0.7.0
Apps using this package must declare the camera permission strings the simulated feed needs:
- iOS —
NSCameraUsageDescriptioninInfo.plist. - Android —
<uses-permission android:name="android.permission.CAMERA" />inAndroidManifest.xml.
See the core plugin's README for the rest of the integration setup (Bluetooth, deep links, GitHub Packages repo, MainActivity).
Usage #
import 'package:flutter_meta_wearables_dat/flutter_meta_wearables_dat.dart';
import 'package:flutter_meta_wearables_dat_mock_device/flutter_meta_wearables_dat_mock_device.dart';
// Pre-grant registration + camera so the mock flow doesn't bounce through Meta AI
await MetaWearablesDatMockDevice.configure(
initiallyRegistered: true,
initialPermissionsGranted: true,
);
// `model` defaults to GlassesModel.rayBanMeta; pass any GlassesModel value.
final uuid = await MetaWearablesDatMockDevice.pairGlasses();
await MetaWearablesDatMockDevice.powerOn(uuid!);
await MetaWearablesDatMockDevice.don(uuid);
await MetaWearablesDatMockDevice.setCameraFacing(uuid, CameraFacing.back);
// Optional — replace the live camera with a pre-recorded H.265/HEVC clip
// await MetaWearablesDatMockDevice.setCameraFeed(uuid, videoPath);
// Streaming, photo capture, registration state, etc. all go through the core
// plugin against the mock UUID.
final textureId = await MetaWearablesDat.startStreamSession(uuid);
The Permission, PermissionStatus, and CameraFacing enums are exported from this package.
API #
| Method | Purpose |
|---|---|
configure({initiallyRegistered, initialPermissionsGranted}) |
Reset & enable the mock subsystem |
disable() |
Tear down the mock subsystem |
pairGlasses({model}) / unpairGlasses(uuid) |
Pair / unpair a simulated device (model defaults to GlassesModel.rayBanMeta) |
powerOn(uuid) / powerOff(uuid) |
Power the device on / off |
don(uuid) / doff(uuid) |
Simulate the user wearing / removing the glasses |
setCameraFacing(uuid, facing) |
Switch front / back camera |
setCameraFeed(uuid, path?) |
Override the camera feed with a video file (H.265/HEVC) |
setCapturedImage(uuid, path?) |
Override the photo returned by capturePhoto |
setPermission(p, s) / setPermissionRequestResult(p, s) |
Override permission state for testing |
Migrating from flutter_meta_wearables_dat 0.3.x #
Mock APIs used to live on the core plugin under MetaWearablesDat.pairMockRayBanMeta() etc. They moved here in 0.4.0 — see the migration table in the changelog.
Example app #
The end-to-end example lives in the core plugin's repo and exercises the full flow including this add-on: see flutter_meta_wearables_dat/example.
License #
MIT — see LICENSE.