AR Try-On View

Flutter augmented reality (AR), Android & Web 3D Face, Hand, Wrist & Foot AR, virtual try-on and remote GLB placement

pub.dev Pub points Pub likes Monthly downloads GitHub stars Apache 2.0 CI Android iOS Web

Bring interactive product previews into your Flutter application. ar_tryon_view is an open-source Flutter plugin for native camera overlays, experimental real-time 2D glasses try-on and 3D Face AR on Android and Web, and placing GLB 3D models on real-world surfaces using Google ARCore or compatible WebXR devices. Load a local GLB file or a direct HTTPS model URL. Experimental MediaPipe hand and pose tracking extends try-on to watches, rings, bracelets, shoes and rigid body accessories.

Designed for developers building e-commerce, eyewear shopping, furniture visualization, product catalogs, virtual fitting experiences and augmented reality prototypes.

Pub.dev · API reference · Example app · Changelog · Report a bug

Development preview — 0.0.9: Remote HTTPS GLB loading and experimental Web support are available in this development branch. Published package badges may reflect older releases. Browser and device validation is pending.


Why AR Try-On View?

Experience What it offers
Virtual eyewear try-on Experimental eye-landmark-based 2D glasses positioning, scaling and roll on Android.
Native 3D Face AR Experimental ARCore face-pose tracking, GLB accessories and optional facial mesh depth occlusion.
Native camera overlay Display transparent PNG graphics over a front-facing CameraX or AVFoundation preview.
3D augmented reality Select a local GLB model and place it on a horizontal surface using native Android ARCore.
Flutter-friendly integration A widget, a per-view controller and a dedicated 3D placement API.
On-device vision Face landmark inference via ML Kit; no cloud inference API key required by this plugin.
Open source Apache 2.0 license, inspectable Dart, Kotlin and Swift source.

Contents

Features and platform support

Capability Android iOS Web
Front camera preview ✅ ✅ 🧪
Static PNG/JPG camera overlay ✅ ✅ 🧪
Runtime image switching and clearing ✅ ✅ 🧪
Real-time eye landmark detection 🧪 — 🧪
Automatic 2D overlay position, scale and roll 🧪 — 🧪
Landmark motion smoothing 🧪 — —
Hide tracked effect when eyes are lost 🧪 — 🧪
Native ARCore Augmented Faces 🧪 — —
3D GLB accessories attached to facial poses 🧪 — 🧪
Configurable region, size, offset and rotation 🧪 — 🧪
Optional face mesh depth occlusion 🧪 — —
Local GLB document picker ✅ — 🧪
Remote HTTPS GLB loading 🧪 — 🧪
Hand/wrist/finger GLB try-on 🧪 (WebView) — 🧪
Foot/ankle GLB try-on 🧪 (WebView) — 🧪
Rigid ear/neck/torso/hip accessories 🧪 (WebView) — 🧪
WebXR surface placement — — 🧪 (device-dependent)
ARCore horizontal plane placement ✅ — —
Instant Placement fallback ✅ — —
Reposition 3D model ✅ — 🧪
Unsupported-platform fallback widget ✅ ✅ ✅

✅ Implemented in source · 🧪 Experimental, device testing required · — Not implemented.

ML Kit tracking is a 2D eyewear preview; the independent ARCore Face AR mode uses native 3D facial poses and geometry. Neither is a calibrated physical fitting tool or clothing generation model. The static overlay remains the default on both mobile platforms.

Installation

Published package

flutter pub add ar_tryon_view

This installs the latest published release. Check its changelog for the APIs it contains.

Try the 0.0.9 development version

To use the new features in this README before publication, add the Git dependency:

dependencies:
  flutter:
    sdk: flutter
  ar_tryon_view: 0.0.10
    
flutter pub get

Once version 0.0.9 is published, the equivalent dependency constraint will be ar_tryon_view: ^0.0.10.

Requirements

Requirement Version / condition
Flutter 3.32 or newer (declared minimum)
Dart 3.8.1 or newer, below 4.0
Android API 24+ (minSdk 24)
iOS 12.0+ declared by the plugin podspec; your Flutter toolchain may require a higher minimum
Android face tracking Google Play services and available ML Kit face detection model
Android 3D AR ARCore-compatible physical device and Google Play Services for AR

See Google's ARCore supported devices list. Android platform support is not the same as hardware compatibility.

Platform setup

Android

Set the minimum SDK in the host app's android/app/build.gradle.kts:

android {
    defaultConfig {
        minSdk = 24
    }
}

For Groovy-based projects use minSdkVersion 24 in the same block. Add camera permission to the host app's android/app/src/main/AndroidManifest.xml, inside the manifest and outside the application element:

<uses-permission android:name="android.permission.CAMERA" />

Request camera permission at runtime before starting the preview. The examples below use the optional permission_handler package:

flutter pub add permission_handler

iOS

Add the camera usage description to ios/Runner/Info.plist, inside its main dictionary:

<key>NSCameraUsageDescription</key>
<string>Camera access is required for the virtual try-on preview.</string>

The plugin uses AVFoundation for the static front-camera overlay and requests permission through the native camera API if needed. If using permission_handler on iOS, also follow its iOS camera configuration instructions. iOS face tracking and ARKit world placement are not yet implemented.

Quick start

1. Add a transparent image

Place a PNG file in your application's assets folder and register it in pubspec.yaml:

flutter:
  assets:
    - assets/glasses_01.png

2. Import and display the try-on widget

After granting camera permission, place the widget in a bounded layout. For tracked eyewear, start the camera after the native view is laid out.

import 'package:ar_tryon_view/ar_tryon_view.dart';
import 'package:flutter/material.dart';

// Inside a widget build method, after camera permission is granted:
SizedBox(
  height: 400,
  child: ArTryOnView(
    trackFace: ArTryOnView.supportsFaceTracking,
    onCreated: (controller) {
      WidgetsBinding.instance.addPostFrameCallback((_) async {
        try {
          await controller.start();
          await controller.setEffectAsset('assets/glasses_01.png');
        } catch (error) {
          debugPrint('AR preview: $error');
        }
      });
    },
  ),
)

For a traditional static overlay, set trackFace: false or omit it entirely.

The trackFace option is read at native view creation. To change modes, recreate the platform view with a different key and manage the previous controller lifecycle.

Complete Flutter example

A minimal interactive preview with camera permission, a tracked Android eyewear mode, a static iOS mode, and show/clear controls. Add the asset and permission configuration above first.

import 'package:ar_tryon_view/ar_tryon_view.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MaterialApp(home: TryOnPage()));
}

class TryOnPage extends StatefulWidget {
  const TryOnPage({super.key});

  @override
  State<TryOnPage> createState() => _TryOnPageState();
}

class _TryOnPageState extends State<TryOnPage> {
  ArTryOnController? _controller;
  bool _ready = false;

  Future<void> _start(ArTryOnController controller) async {
    try {
      if (!mounted) return;
      final permission = await Permission.camera.request();
      if (!mounted) return;

      if (!permission.isGranted) {
        _showError('Camera permission is required.');
        return;
      }

      await controller.start();
      if (!mounted) return;
      setState(() => _ready = true);
    } catch (error) {
      _showError(error);
    }
  }

  Future<void> _applyEffect() async {
    try {
      await _controller?.setEffectAsset('assets/glasses_01.png');
    } catch (error) {
      _showError(error);
    }
  }

  Future<void> _clearEffect() async {
    try {
      await _controller?.clearEffect();
    } catch (error) {
      _showError(error);
    }
  }

  void _showError(Object error) {
    if (!mounted) return;
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(content: Text(error.toString())),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Virtual Try-On')),
      body: Column(
        children: [
          Expanded(
            child: ArTryOnView(
              trackFace: ArTryOnView.supportsFaceTracking,
              unsupportedBuilder: (_) => const Center(
                child: Text('Camera preview is not supported here.'),
              ),
              onCreated: (controller) {
                _controller = controller;
                WidgetsBinding.instance.addPostFrameCallback((_) {
                  if (mounted) _start(controller);
                });
              },
            ),
          ),
          SafeArea(
            top: false,
            child: Padding(
              padding: const EdgeInsets.all(16),
              child: Row(
                children: [
                  Expanded(
                    child: FilledButton(
                      onPressed: _ready ? _applyEffect : null,
                      child: const Text('Try on glasses'),
                    ),
                  ),
                  const SizedBox(width: 12),
                  OutlinedButton(
                    onPressed: _ready ? _clearEffect : null,
                    child: const Text('Clear'),
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }
}

The platform view releases its native resources on removal. For explicit teardown while the view is still attached, use the controller's dispose() method and do not reuse that controller. For a fuller demonstration including GLB placement, see the example project.

Dynamic image overlays

Update a product preview without rebuilding the entire camera widget:

await controller.setEffectAsset('assets/glasses_black.png');
await controller.setEffectAsset('assets/glasses_gold.png');
await controller.clearEffect();

You can also supply encoded image bytes from your own product catalog, cache or file picker:

// imageBytes is a Uint8List containing encoded PNG or JPG data.
await controller.setEffectBytes(imageBytes);

The plugin does not fetch remote assets automatically. Download or cache remote images in your application, validate them, then pass their bytes to the controller. Use transparent PNGs for overlays; JPEG has no alpha channel.

How the experimental Android tracker works

  1. CameraX supplies preview and analysis frames.
  2. ML Kit detects facial landmarks and selects the largest detected face.
  3. Eye coordinates are mapped into preview space.
  4. Eye midpoint, distance and angle determine the 2D overlay transform.
  5. Exponential smoothing reduces visible jitter.
  6. The overlay is hidden when the required landmarks cannot be located.

Tracking is intended for a mostly front-facing user. Profile views, occlusion, low light and unsuitable asset padding can affect alignment. Actual performance has not yet been benchmarked.

Native 3D Face AR

Use ARCore Augmented Faces to attach a local 3D GLB model to a tracked facial pose. This is a separate native front-camera AR screen, not the ML Kit 2D overlay or rear-camera floor placement.

Quick start

if (ArFacePlacement.isSupported) {
  await ArFacePlacement.pickAndOpen(
    region: ArFaceRegion.faceCenter,
    modelSizeM: 0.15,
  );
}

Choose a GLB file. The model is rendered automatically when a face is tracked, without tapping or floor detection. ARCore front-camera support, Google Play Services for AR and camera permission are required.

Customize model alignment

final file = await ArFacePlacement.pickGlb();
if (file != null) {
  await ArFacePlacement.open(
    modelUri: file.uri,
    region: ArFaceRegion.faceCenter,
    modelSizeM: 0.15,
    offsetX: 0,
    offsetY: 0.025,
    offsetZ: 0.06,
    rotationX: 0,
    rotationY: 0,
    rotationZ: 0,
    occlusion: true,
  );
}
Option Meaning
region faceCenter, noseTip, foreheadLeft or foreheadRight.
modelSizeM Longest model dimension in meters; default 0.15.
offsetX / offsetY / offsetZ Translation in meters relative to the selected pose.
rotationX / rotationY / rotationZ Model rotation in degrees.
occlusion Optional depth-only facial mesh; defaults to false.

Face models are centered on their geometry bounds rather than bottom-aligned as in floor AR. Tune size, position and orientation per asset. Defaults are initial eyewear approximations, not measured fit. For nose or forehead accessories, adjust the offsets. Advanced PBR and transparent lenses are not fully supported.

Test with a 3D face mask

Use a locally saved curved GLB face mask or glasses model with eye openings, embedded base colors and preferably 16-bit mesh indices. For example, if you have the sample face_ar_test_mask.glb, select it from the Android document picker. The sample file is not currently bundled with this repository.

await ArFacePlacement.pickAndOpen(
  region: ArFaceRegion.faceCenter,
  modelSizeM: 0.15,
  offsetX: 0.0,
  offsetY: 0.025,
  offsetZ: 0.06,
  rotationX: 0.0,
  rotationY: 0.0,
  rotationZ: 0.0,
  occlusion: false,
);

On a compatible physical Android device, open the example app, choose Choose .glb and apply to face, and select the model. Check face alignment while moving and rotating your head, moving closer or farther from the camera, and briefly leaving the camera frame. Then repeat with occlusion: true. The values above are starting points; different assets may require different transforms.

Live 3D model fitting controls (planned)

A future update will aim to make calibration interactive within the native Face AR screen:

  • Live scaling: pinch or a slider to change model size.
  • Position adjustment: move the model along the face-local X, Y and Z axes.
  • Rotation adjustment: adjust pitch, yaw and roll independently.
  • Reset fitting: restore the initial model transform.
  • Calibration feedback: preview transform changes while face tracking remains active.
  • Export calibration: expose the selected transform values for reuse with the same product model.

Currently, size, offsets and rotations are supplied through ArFacePlacement.open() or pickAndOpen() before opening the native screen. In-screen fitting controls and calibration export are not implemented yet.

Rendering pipeline

GLB picker -> Native Face AR Activity
                      |
              ARCore front camera
                      |
                AugmentedFace
                      |
              Face / region pose
                      |
         Local offset, rotation, scale
                      |
           Shared native GLB renderer

The model disappears when the face stops tracking. Optional occlusion writes the facial mesh to the depth buffer but does not model hair or all real-world occluders. Front-camera world tracking is PAUSED by design, so the screen uses the AugmentedFace tracking state rather than the camera tracking state. ARCore already mirrors the display projection.

Experimental, Android only: device compatibility, visual alignment and occlusion require physical-device validation. The launch Future completes when the screen opens; restart the CameraX preview after returning if necessary.

3D GLB product placement

Bring furniture, home decor, appliances or other 3D product models into a physical room using ARCore on supported Android devices.

One-line integration

if (ArGlbPlacement.isSupported) {
  await ArGlbPlacement.pickAndOpen(modelSizeM: 0.55);
}

Pick a model, inspect its metadata and launch AR

import 'package:ar_tryon_view/ar_tryon_view.dart';
import 'package:flutter/services.dart';

// Call from an async button handler.
try {
  if (ArGlbPlacement.isSupported) {
    final model = await ArGlbPlacement.pickGlb();

    if (model != null) {
      print('Model: ${model.name} (${model.readableSize})');
      await ArGlbPlacement.open(
        modelUri: model.uri,
        modelSizeM: 0.55,
      );
    }
  }
} on PlatformException catch (error) {
  print('AR error: ${error.code}: ${error.message}');
}

The native document picker returns null if cancelled. modelSizeM is a positive finite size parameter in meters, not a guarantee of calibrated physical dimensions.

Placement workflow

Select local .glb model
          |
          v
    Native ARCore view
          |
          v
  Detect horizontal surface
  or use Instant Placement
          |
          v
   Aim and tap to place
          |
          v
  Anchored 3D product model

The renderer supports embedded base-color textures, baseColorFactor, multiple materials and mesh primitives, EXT_texture_webp base-color sources and common mesh index formats. Advanced PBR features (normal-map lighting, transmission, sheen, clearcoat and specular effects) are not fully implemented.

ARCore uses the rear camera and needs exclusive access. The existing CameraX preview may need to be restarted after returning from native placement. open() launches the native screen; its Future does not signal that the user has closed that screen.

Hand, Wrist, Foot & Body AR

The experimental unified ArVirtualTryOn API attaches rigid GLB accessories to tracked anatomical targets. Android uses a dedicated secure WebView with the shared MediaPipe and Three.js engine; Web uses the bundled browser engine. Existing native ARCore Face AR and Floor AR remain independent.

Virtual watch and ring try-on

await ArVirtualTryOn.openUrl(
  url: 'https://your-cdn.example/watch.glb',
  target: ArTarget.leftWrist,
  modelSizeM: 0.055,
);
await ArVirtualTryOn.pickAndOpen(
  target: ArTarget.rightRingFinger,
  modelSizeM: 0.022,
);

Virtual shoe try-on

await ArVirtualTryOn.openUrl(
  url: 'https://your-cdn.example/shoe.glb',
  target: ArTarget.leftFoot,
  modelSizeM: 0.26,
  camera: ArTryOnCamera.rear,
);

Use rightFoot for the other foot or bothFeet to track both independently. Both-feet mode repeats the same mesh, not a separate left/right shoe pair. It does not mirror an asymmetric shoe. Pose Landmarker needs enough of the person visible, so an isolated close-up of feet may not work. The displayed size is a visual approximation, not shoe-size measurement.

Supported targets

Targets Tracker / rendering
face, nose Existing Face AR
leftHand, rightHand, leftWrist, rightWrist MediaPipe Hand Landmarker
leftRingFinger, rightRingFinger, leftIndexFinger, rightIndexFinger MediaPipe Hand Landmarker
leftFoot, rightFoot, bothFeet, leftAnkle, rightAnkle MediaPipe Pose Landmarker
leftEar, rightEar, neck, upperBody, lowerBody Approximate rigid accessory placement using Pose Landmarker
floor Existing Floor AR
wall Reserved; not implemented

The selected anatomical side is obtained from the landmark model; verify left/right alignment on real devices. Lost or low-confidence landmarks hide the model. Position, orientation and scale are smoothed between frames. Hand and pose inference use separately loaded MediaPipe task models.

Calibration and camera selection

await ArVirtualTryOn.pickAndOpen(
  target: ArTarget.leftWrist,
  modelSizeM: 0.055,
  offsetX: 0,
  offsetY: -0.01,
  offsetZ: 0.015,
  rotationX: 0,
  rotationY: 0,
  rotationZ: 90,
  camera: ArTryOnCamera.rear,
);

Offsets are in approximate local meters; rotations are degrees. Hand assets should use +Y along the fingers; foot assets should use +Z toward the toes and +Y toward the ankle. Geometry is centered and normalized by the longest dimension. Tune per asset. Body targets use the rear camera by default, and front camera is selectable. Face and floor delegate to their existing camera modes. Floor placement uses its existing scale-only configuration.

The example app has a body target selector, camera selector, local GLB button and HTTPS model URL button. Tap Start camera after the model loads. The new modes need internet access for pinned MediaPipe/Three.js resources and a modern Android System WebView or browser with camera/WebGL/WASM support.

Limitations: Experimental rigid overlays only. No dedicated foot detector, calibrated sizing, full-body clothing deformation, body-part segmentation/occlusion, live fitting sliders or separate left/right shoe asset pairing. iOS is not supported for these modes. Test camera permissions, actual handedness, pose accuracy, alignment and frame rate before production use.

Remote GLB model loading

Android and Web use the same public APIs. The URL must point directly to a standalone GLB 2.0 file.

Face AR

await ArFacePlacement.openUrl(
  url: 'https://your-cdn.example/glasses.glb',
  modelSizeM: 0.15,
  offsetY: 0.025,
  offsetZ: 0.06,
);

Floor AR

await ArGlbPlacement.openUrl(
  url: 'https://your-cdn.example/chair.glb',
  modelSizeM: 0.55,
);

These are illustrative URLs; replace them with your hosted models. HTTPS only, no embedded credentials or redirect responses, maximum 50 MiB, bounded network reads, and GLB magic/version/length validation. Android stores downloads in unique app-private temporary directories before handing them to the existing native renderer; persistent cache reuse and explicit eviction are not provided yet. Web downloads in the AR iframe, with browser CORS enforcement. Errors during browser model loading are shown inside the AR screen. Embedded resources are required; external GLTF textures are not supported. These APIs return when the screen is launched, not when tracking is ready or the screen closes.

Flutter Web support

No custom edits to a host app's index.html are needed for the bundled AR view. Run the example with:

cd example
flutter pub get
flutter run -d chrome

For deployment:

flutter build web

Host the output over HTTPS (localhost is acceptable for development). Use the normal Dart/JavaScript Flutter Web build; this experimental browser backend uses dart:html, so WebAssembly builds are not supported yet.

Browser implementation

  • MediaDevices getUserMedia for the front camera.
  • Canvas for static PNG and MediaPipe eye-landmark overlays.
  • MediaPipe Face Landmarker for 3D facial pose rotation and landmark positions.
  • Three.js GLTFLoader and WebGL for face-attached 3D models.
  • WebXR immersive-ar sessions and hit tests for floor/surface placement.

MediaPipe 0.10.21, its WASM/model files and Three.js 0.170.0 are fetched from pinned CDN URLs at runtime. An internet connection and browser policy permitting those assets are required; offline packaging is not included. Camera inference runs locally, not through a cloud inference API. Face alignment and scale use a landmark-based approximation on the Web; physical fit, native-quality occlusion and device-wide compatibility are not guaranteed. Set occlusion to false on Web.

Web floor placement requires a browser/device supporting immersive-ar and hit-test. A desktop webcam can support face try-on without supporting WebXR floor AR. The screen displays an unsupported-device message when the WebXR session is not available.

Hosting and CORS

For remote models on a different origin, the model server must allow the Flutter website origin in Access-Control-Allow-Origin. The AR iframe is same-origin and needs camera and xr-spatial-tracking permission. Do not serve the application over insecure HTTP or use cross-origin iframe policies that block those features. Restrictive CSP policies must permit the documented CDN scripts, WASM and model fetches.

The existing Android camera and ARCore paths are retained. iOS still provides only the static camera overlay.

API reference

ArTryOnView

Property / getter Type Purpose
onCreated void Function(ArTryOnController)? Obtain the controller for this platform view.
trackFace bool Opt into experimental Android 2D tracking; defaults to false.
creationParams Map<String, dynamic>? Additional parameters passed to the native view.
unsupportedBuilder WidgetBuilder? Custom fallback on unsupported platforms.
isSupported static bool Whether the current platform has a native preview implementation.
supportsFaceTracking static bool Android/Web platform check; not a model readiness check.

ArTryOnController

Method / property Purpose
id Native platform view identifier.
start() Start the front camera.
stop() Stop the camera preview.
setEffectAsset(String assetPath) Load an encoded image from Flutter assets.
setEffectBytes(Uint8List bytes) Apply encoded PNG/JPG bytes.
clearEffect() Remove the image overlay.
dispose() Explicitly release resources; controller is no longer reusable.

ArVirtualTryOn

API Purpose
isSupported / supportsTarget(target) Platform and implemented target checks, not hardware guarantees.
defaultSize(target) Suggested longest model dimension in meters.
open(modelUri: ..., target: ...) Open a model URI with the selected tracker.
pickAndOpen(target: ...) Pick a local GLB and launch target tracking.
openUrl(url: ..., target: ...) Open a direct HTTPS GLB.
ArTryOnCamera Rear/front camera selection for body targets.

ArFacePlacement

API Purpose
ArFacePlacement.isSupported Android/Web platform check, not hardware compatibility.
pickGlb() Select local GLB through the shared document picker.
open(...) Launch native Face AR with configurable region and transforms.
pickAndOpen(...) Select and launch Face AR.
openUrl(url: ...) Load a direct HTTPS GLB and launch Face AR.
ArFaceRegion faceCenter, noseTip, foreheadLeft, foreheadRight.

ArGlbPlacement and ArGlbFile

API Purpose
ArGlbPlacement.isSupported Android/Web platform availability check.
pickGlb() Open the native picker and return nullable model metadata.
open(modelUri: ..., modelSizeM: ...) Launch the native 3D placement screen.
pickAndOpen(modelSizeM: ...) Select and launch in one call.
openUrl(url: ...) Load a direct HTTPS GLB and launch floor AR.
ArGlbFile.uri Model document URI.
ArGlbFile.name Display filename.
ArGlbFile.sizeBytes File size, or a negative value if unknown.
ArGlbFile.readableSize Human-readable size when known.

The controller and placement methods are asynchronous. Catch PlatformException, ArgumentError and UnsupportedError as appropriate.

Architecture

                    Flutter application
                           |
                      ar_tryon_view
                           |
           +---------------+----------------+
           |                                |
      ArTryOnView                    ArGlbPlacement
      ArTryOnController                     |
           |                           MethodChannel
     Platform view + channel                |
           |                          Android ARCore
     +-----+----------+                Native GLB renderer
     |                |
  Android            iOS
  CameraX         AVFoundation
     |
  ML Kit (optional 2D tracking)
     |
  Landmark transform + smoothing
Technology Role
Flutter / Dart Public widget, controller and placement APIs
Kotlin / CameraX Android camera preview and frame analysis
Google ML Kit On-device face landmark inference
Swift / AVFoundation iOS front camera and static image overlay
ARCore Android surface anchoring and separate Augmented Faces 3D tracking
Native GLB renderer Lightweight embedded-texture 3D visualization

Asset preparation

Eyewear images

  • Use transparent PNG graphics, preferably with the glasses facing forward.
  • Crop empty margins tightly and align the center between the lenses.
  • Use a consistent canvas and proportions across product variants.
  • Avoid oversized images; choose resolution appropriate for the phone preview.
  • Check the sample asset at example/assets/glasses_01.png.

GLB models

  • Export a single binary glTF 2.0 (.glb) with embedded textures.
  • Optimize meshes and texture sizes for mobile rendering.
  • Test base-color appearance before relying on advanced PBR materials.
  • Use consistent orientation, origin and scale.
  • Test placement under real-world lighting on an ARCore-supported device.

Use cases

Project Suitable feature
Online eyewear store Experimental Android 2D and 3D glasses preview; static overlay on iOS
Furniture shopping Android ARCore floor placement of GLB products
Retail product catalog Camera overlay and mobile 3D product visualization
Branded camera experiences Static PNG graphics and promotional overlays
AR learning and prototypes Native camera integration and surface anchoring

Jewelry, makeup and apparel fitting require additional tracking/rendering capabilities and are not advertised as implemented features.

Performance and privacy

Performance considerations

  • CameraX analysis uses a keep-only-latest backpressure strategy to avoid building a frame queue.
  • Experimental landmark tracking uses ML Kit fast mode and a smoothed 2D transform.
  • Stop camera work when the preview is no longer needed.
  • Avoid repeatedly decoding large overlay assets; optimize 3D meshes and textures.
  • No measured FPS, latency, tracking accuracy or battery benchmarks are claimed yet.

Privacy considerations

Face landmark inference is handled by the device's ML Kit pipeline. This plugin does not implement cloud camera-frame uploads, facial identity recognition or persistent face storage. The Google Play services ML Kit model may require an initial download and is subject to Google's own data practices. The host app is responsible for permission handling, consent, privacy disclosures and any additional processing or storage.

Troubleshooting and FAQ

Issue Suggested action
Camera permission denied Add the platform permission declarations, request permission and check device settings.
Camera view is black Check permission, view layout, lifecycle and other active camera sessions. Retry start after layout.
Tracked glasses are invisible Make both eyes visible, check Play services/model readiness and use a transparent tightly cropped PNG.
Overlay looks too large or misaligned Check padding, lens alignment, asset proportions and head pose. The experimental tracker uses a fixed eye-distance scale heuristic.
Face AR model misaligned Tune offsets, scale, rotation and region; disable occlusion while calibrating.
Face AR unavailable Check ARCore front-camera support and permission.
iOS does not follow the face iOS currently supports only static overlays.
AR does not launch Verify ARCore device compatibility and Google Play Services for AR installation.
GLB file is rejected Use the .glb format, a readable document URI and a valid positive model size.
Camera stops after 3D placement Restart the preview after returning to the Flutter screen.
Invalid constant value Platform capability getters are runtime values. Do not wrap widgets using those getters in const constructors.
Web camera does not start Use HTTPS/localhost, grant camera permission and verify MediaPipe CDN access.
Web GLB does not load Use a direct HTTPS GLB URL, check CORS, embedded resources and size limit.
Web floor AR unavailable Use a device/browser with immersive-ar and hit-test support.
Native desktop shows fallback Native Windows/macOS/Linux rendering is not implemented.
New APIs cannot be found Verify the installed package version. Use the Git development dependency for unreleased 0.0.9 APIs.

Does it require an API key or paid subscription?

No API key or subscription is required by the current plugin. Android face detection relies on Google Play services, and ARCore requires a compatible device.

Does face tracking work offline?

The inference is on-device once the required model is available. The Play services model may need a network connection for its initial download.

Is this a full virtual fitting or 3D face tracking SDK?

No. The plugin offers experimental 2D eyewear and native Android 3D face-pose rendering with optional facial mesh depth occlusion. It does not provide calibrated physical fit, clothing simulation or complete real-world occlusion.

Is GLB placement supported on iOS?

Not yet. Native GLB surface placement is Android-only; compatible WebXR browsers have a separate experimental implementation.

Can I use this package in a commercial application?

The project uses Apache License 2.0. Review its terms and the licenses of any dependencies or third-party product assets.

Roadmap

The following are planned directions, not released features or guaranteed delivery dates.

Priority Planned improvement
High Validate Android tracking, improve eyewear calibration and handle camera lifecycle edge cases.
High iOS Vision face landmarks and ARKit/RealityKit product placement.
High Swift Package Manager migration and broader device testing.
High Validate 3D Face AR on real devices and improve model calibration.
High Interactive live Face AR fitting: scale, X/Y/Z translation, pitch/yaw/roll, reset and calibration export.
Medium Image capture and improved rendering.
High Validate experimental Web camera, Face AR and WebXR on physical devices.
Medium Persistent remote model cache, offline Web assets and WebAssembly-compatible interop.
High Validate experimental hand/wrist/finger and foot tracking; improve calibration and handedness.
Later Dedicated close-up foot landmarks, separate shoe pair assets, body occlusion and cloth deformation.

Follow progress or suggest a feature through GitHub Issues.

Development and contributing

git clone https://github.com/NafimAhmed/ar-tryon-view.git
cd ar-tryon-view
git checkout feature/web-and-remote-glb
flutter pub get
flutter analyze
flutter test
cd example
flutter pub get
flutter run

Use a physical Android device to validate ARCore and experimental eyewear tracking. Use a physical iOS device to validate native camera overlays. CI is configured to run analysis, unit tests, a publication dry run and an Android debug build; its presence does not imply all checks have passed.

Contributions, documentation fixes, reproducible bug reports and feature requests are welcome. Include your Flutter version, platform, device model, reproduction steps and relevant error logs when reporting an issue. Avoid including private camera images or personal information in public bug reports.

License

Released under the Apache License 2.0.

Copyright 2026 Nafim Ahmed. See LICENSE and NOTICE for details.


Made for the Flutter developer community.

If this plugin helps you build an augmented reality application, consider starring the GitHub repository or liking the package on pub.dev. Contributions and real-device feedback help improve the project.

Back to top

Author and contact

Nafim Ahmed — Creator and Maintainer

Known limitations

  • Hand, wrist, finger, foot and body AR are experimental. Android uses a shared MediaPipe/Three.js WebView engine; native Face and Floor AR still use ARCore.
  • Shoe tracking uses pose landmarks, not a dedicated foot detector. Both-feet mode repeats one GLB rather than separate left/right shoe models.
  • Body occlusion, cloth deformation and calibrated physical sizing are not supported.
  • Web requires HTTPS or localhost, camera permission, network access to runtime assets, and CORS-enabled remote models. Floor AR requires a compatible WebXR device; Web face occlusion is unavailable.
  • iOS currently supports static camera overlays only. New AR modes still require build, browser and real-device validation.