Prerequisites
- A working Flutter quickstart
- One initialized
NosmaiCameraPreview
Apply a subtle preset
Call the beauty methods after onInitialized:
final nosmai = NosmaiFlutter.instance; await nosmai.applySkinSmoothing(0.35); await nosmai.applySkinWhitening(0.10); await nosmai.applySharpening(0.15); await nosmai.applyTeethWhitening(0.20);
Parameter ranges
| Method | Range | Off value | Visible result |
|---|---|---|---|
applySkinSmoothing | 0.0 to 1.0 | 0.0 | Softens skin detail |
applySkinWhitening | 0.0 to 1.0 | 0.0 | Brightens skin tone |
applySharpening | 0.0 to 1.0 | 0.0 | Restores edge detail |
applyTeethWhitening | 0.0 to 1.0 | 0.0 | Brightens detected teeth |
For a slider, clamp the value and avoid awaiting stale updates after the widget has been disposed.
Reset beauty
await NosmaiFlutter.instance.removeBuiltInFilters();
Verify it worked
Set smoothing to 0.0, then 0.35, while a face is visible. The preview should change without rebuilding NosmaiCameraPreview.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
SDK not initialized. Please initialize the SDK first. | The method ran before initialization | Await NosmaiFlutter.initialize before mounting the camera screen |
| No visible change | The callback ran before the native preview was ready | Apply from onInitialized |
| Preview restarts while dragging | The camera widget is rebuilt with a changing key | Keep one stable preview and update only the effect value |