Flutter SDK selfie checkup
One photo of the person's face, ten skin biomarkers: show the selfie checkup in your Flutter app.
The selfie checkup takes one photo of the person's face and returns up to ten skin biomarkers, such as redness, hydration, lines and perceived age. The Flutter SDK page says how to add and start the SDK.
Show the checkup
YouthFaceSelfieFrame is the whole selfie screen: the camera, a face outline that guides the
person, the countdown, the photo to check, and the Retake and Submit buttons. Give it your
callbacks. The selfie takes nothing of the person; give it user, with their age and gender, only
for YOU(th)'s scores:
YouthFaceSelfieFrame( theme: const YouthVideoFrameTheme(), onFinalResults: (biomarkers) => save(biomarkers), onError: (error) => showError(error.message),)The camera fills the height the screen gives it, so place it where its height is bounded, such as
the body of a Scaffold. Ask the person for the camera before you show it.
- The person places their face. The SDK checks on the device that one face is in the frame, close enough, centred, looking straight ahead and in good light, and says what to change.
- A countdown of three seconds starts once all is right, and the photo is taken.
- The person checks the photo, and taps Submit, or Retake for a new one.
- The photo is analysed, usually in 5 to 15 seconds, and
onFinalResultsreceives the biomarkers.
After the results, or an error, the screen is ready for a new photo. Given another user, it drops
a photo not yet sent, so that one person's photo is never sent as another's. A photo's results and
scores go to the callbacks the screen had when it was sent.
- The photo leaves the device. The face check while the person positions themselves stays on the device, but the photo they submit is sent for analysis. Tell the person so before they take it. The SDK keeps the photo in memory only, never in a file.
- A connection is needed from the moment the person submits the photo until the results arrive.
- Even light makes the photo clear: facing a window or a soft light, without glasses, make-up or hair over the face.
Results
Up to ten biomarkers, each a number: eight scores from 0 to 100, higher always better, and two ages in years. Results lists them, as the Web SDK returns them too.
Errors
onError receives a YouthFaceSelfieErrorData: a code, and a message for the person, in their
language. After any error the photo is discarded and the person takes a new one.
code | What happened, and what to do |
|---|---|
cameraUnavailable | The camera could not open or take the photo. Ask for the camera permission, then open the screen again. |
checkupCreateFailed | The checkup could not start: the connection failed, or YOU(th) refused it. A refusal means the selfie is not on for this key, a monthly limit, or a revoked key. |
uploadFailed | The photo could not be uploaded. Check the connection. |
analysisFailed | The photo could not be analysed. Take a new one in even light. |
resultsUnavailable | The results did not arrive within two minutes, held no biomarker, or YOU(th) refused to give them. Try again later. |
failed | Anything else. Try again. |
Your own screen
To lay out the screen yourself, show a YouthFaceSelfieDetectionFrame, which guides the person and
takes the photo, and send the photo with a YouthFaceSelfieController. YouthVideoFrameTheme has
fields for the selfie's buttons and warnings. The package's own documentation lists them.