FaceLivenessView class

A Flutter widget that shows the native camera preview and exposes callbacks for liveness progress and completion events.

Internally this widget embeds a platform-specific view (AndroidView or UiKitView) whose view type is face_liveness_camera. The native side is responsible for camera initialisation, ML Kit pose detection, progress calculation, and video recording.

The Dart side only needs to display the view and surface the events coming from the MethodChannel named face_live.

Inheritance

Constructors

FaceLivenessView({Key? key, ValueChanged<double>? onProgress, ValueChanged<File>? onCapture, ValueChanged<File>? onImageCapture, double targetYawSpan = 65.0, int timeoutMillis = 15000, int minCompletionTimeMillis = 4000, double minFaceSize = 0.20, int maxMissedFrames = 5, bool requireBidirectionalMovement = true, bool enablePitchDetection = true, int captureDelayMillis = 1500})
const

Properties

captureDelayMillis int
Delay in milliseconds after reaching 100% before capturing. Gives users time to position themselves optimally for the final shot.
final
enablePitchDetection bool
Whether to enable pitch (up/down) movement detection alongside yaw. When true, head movement up/down also contributes to liveness progress.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxMissedFrames int
Maximum consecutive frames without face detection before failing. Helps ensure continuous face presence during the session.
final
minCompletionTimeMillis int
Minimum time in milliseconds before liveness can complete. Prevents too-fast completion which could indicate spoofing.
final
minFaceSize double
Minimum face size as a fraction of the frame (0.0 - 1.0). Face bounding box must cover at least this fraction of the frame area.
final
onCapture ValueChanged<File>?
Callback invoked when liveness succeeds. Returns the recorded video file.
final
onImageCapture ValueChanged<File>?
Callback invoked when liveness succeeds. Returns the captured image file.
final
onProgress ValueChanged<double>?
Callback invoked whenever liveness progress (0–100) changes.
final
requireBidirectionalMovement bool
Whether to require bidirectional movement (both left AND right). When true, user must move head both directions from center.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
targetYawSpan double
Target yaw span in degrees that must be covered to reach 100% progress. Default is 65° for easier liveness detection.
final
timeoutMillis int
Timeout in milliseconds before the liveness session fails.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<FaceLivenessView>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited