Docs / Flutter / Quick start
Flutter quick start
Add facevity_flutter, set up a licence for your Android package name and iOS bundle ID, and show a beautified camera with FacevityPreview.
Demo app: facevity-flutter-demo on GitHub
facevity_flutter wraps the native Android SDK (com.knight98:facevity 0.3.3, OpenGL ES) and the iOS SDK (pod Facevity, Metal) and exposes the same API in Dart. Frames never cross the platform channel: they are processed natively, in the plugin’s camera preview or inside the RTC SDK’s own capture pipeline. Dart only sends settings.
| Android | iOS | |
|---|---|---|
| Engine | com.knight98:facevity 0.3.3 |
pod Facevity |
| Preview | CameraX, OES texture, Flutter SurfaceProducer texture |
AVCapture, CVPixelBuffer processed in place, FlutterTexture |
| Minimum | Android 7.0 (API 24), Flutter 3.22 | iOS 15, Flutter 3.22 |
1. Install
# pubspec.yaml
dependencies:
facevity_flutter:
git: { url: <Facevity repository URL from your trial>, path: flutter } # or your private pub server
Android. Set minSdk 24. The plugin depends on com.knight98:facevity:0.3.3; make it resolvable from the app, either by adding the Facevity Maven repository to android/build.gradle or settings.gradle, or with a property in android/gradle.properties:
facevity.mavenUrl=<Facevity Maven URL or local path from your trial>
# optional: facevity.version, facevity.agora / facevity.zego / facevity.flutterWebrtc (true / false)
RTC hooks are detected automatically from the Flutter packages in your app.
iOS. Set platform :ios, '15.0' in the Podfile and add NSCameraUsageDescription to Info.plist. RTC hooks are opt-in:
# ios/Podfile, before `target 'Runner'`
$FacevityRtcHooks = ['agora'] # any of 'agora', 'zego', 'flutter_webrtc' (also used for LiveKit)
2. Initialize
import 'package:facevity_flutter/facevity_flutter.dart';
final fv = await Facevity.initialize(
licenseAsset: 'assets/facevity/license.fvl', // or licenseToken: / licenseFile: / licenseKey: + licenseServerUrl:
params: BeautyParams.natural,
);
3. Choose a look
await fv.setParams(BeautyParams.glam); // presets: defaults, none, natural, glam
await fv.updateParams({'smooth': 70, 'bigEyes': 20}); // change some levels by name
await fv.setLipstick(BeautyColors.rose, 60, gloss: 40); // licence feature beauty.makeup
await fv.setFilter(BeautyFilters.warm, 50);
final props = await fv.availableProps(); // 9 built-in props
await fv.setProp(props.first.id); // licence feature ar.props
await fv.clearProp();
BeautyParams has the 21 parameters of every platform (smooth, brightness, skinTone -100..100, rosy, sharpen, underEye, teethWhitening, slimFace, bigEyes, overall, evenTone, foldSoften, lipColor, jawSlim, filter and filterLevel, eyeBrighten, lipShade, lipGloss, teethBrighten, backlightFix). It is immutable and clamped: copyWith, withLipstick, withFilter, toMap / fromMap, isIdentity, usesMakeup, usesReshape. 0 = off, 50 = natural, 100 = strong.
4. Show the camera
Scaffold(
body: FacevityPreview(fit: BoxFit.cover),
)
FacevityPreview opens the camera natively and renders the processed frames into a Flutter texture. FacevityPreviewController switches cameras and toggles an A/B compare.
5. Capabilities, licence and stats
final caps = await fv.capabilities(); // hide controls that would do nothing
fv.capabilityChanges.listen((c) => setState(() => _caps = c));
fv.licenseChanges.listen((l) => print(l.status));
final stats = await fv.stats(); // fps, ms per frame, faces, drops
The licence is issued for the native application IDs: the Android package name and the iOS bundle identifier (Facevity.appId returns the one in use). One licence can list both.
| Dart | Licence source |
|---|---|
initialize(licenseToken:), setLicenseToken(token) |
a signed token from your backend |
initialize(licenseFile:), setLicenseFile(contents) |
an offline .fvl file’s contents |
initialize(licenseAsset:), setLicenseFileFromAsset(path) |
a .fvl shipped as a Flutter asset |
initialize(licenseKey:, licenseServerUrl:), activateLicense(key) |
online activation |
FacevityOptions(androidLicenseAsset:, iosLicenseResource:) |
a .fvl in the native bundle |
6. Release
await fv.release();
Demo app and next steps
The Flutter demo app has a licence screen, FacevityPreview with every setting, A/B compare, live stats and one call screen per RTC SDK.
Video calls: Agora, ZEGOCLOUD, LiveKit, flutter_webrtc. fv.compiledRtcHooks tells which hooks are in the build, and await fv.rtc.status() reports frames seen, processed and passed through per provider.
Need help with an integration? Contact the Facevity team. We answer integration questions during trials.