face_detector_flutter 1.0.1 copy "face_detector_flutter: ^1.0.1" to clipboard
face_detector_flutter: ^1.0.1 copied to clipboard

A Flutter plugin for real-time face detection using Google ML Kit and Camera. Provides a simple API to detect faces, validate alignment, and capture the face image as bytes (Uint8List) for authenticat [...]

A simple and lightweight face detection + authentication package built with Flutter. It uses the device camera and ML Kit under the hood to detect faces in real time.


πŸš€ Installation #

Add the dependency in your pubspec.yaml:

dependencies:
  face_detector_flutter: ^1.0.0

πŸ”§ Setup #

Android #

Add camera permissions to android/app/src/main/AndroidManifest.xml:

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

iOS #

Add camera permissions to ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>This app needs camera access for face recognition authentication</string>

πŸ“± Example Usage #

class _HomeScreenState extends State<HomeScreen> {
  final FaceDetectorController _faceAuthController = FaceDetectorController();
  FaceAuthState _faceAuthState = FaceAuthState.initializing;
  Uint8List? _bytes;

  void _startDetectingFace() async {
    await _faceAuthController.initialize();
    setState(() {
      _faceAuthState = FaceAuthState.cameraOpened;
    });
    final detectedFaceBytes = await _faceAuthController.detect(
      onDetect: (detectionState) {
        setState(() => _faceAuthState = detectionState);
      },
    );

    _bytes = detectedFaceBytes;
    _faceAuthController.dispose();
  }

  @override
  void initState() {
    super.initState();
    _startDetectingFace();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.blue,
        title: Text("Simple Face Detection Example"),
      ),
      body: Column(
        children: [
          if (_bytes == null) Text(_faceAuthState.name),
          if (_bytes != null)
            Expanded(child: Image.memory(_bytes!))
          else
            Expanded(child: FaceAuthView(controller: _faceAuthController)),
        ],
      ),
    );
  }
}

🧩 Features #

  • πŸ“· Real-time face detection using device camera
  • πŸ” Face authentication (based on detection state)
  • πŸ–Ό Convert detected face to Uint8List (display with Image.memory)
  • ⚑ Lightweight and easy to use

πŸ“„ License #

This project is licensed under the MIT License.

1
likes
130
points
188
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for real-time face detection using Google ML Kit and Camera. Provides a simple API to detect faces, validate alignment, and capture the face image as bytes (Uint8List) for authentication or backend processing.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

camera, flutter, google_mlkit_commons, google_mlkit_face_detection, image, provider, tflite_flutter

More

Packages that depend on face_detector_flutter