Skip to content
pubscout

hand_landmarker

3.1.0, released 2 months ago by an unverified publisher

Real-time hand landmark detection on Android using Google MediaPipe and JNI.

$ flutter pub add hand_landmarker
Source repository

What it does

A Flutter plugin that performs real-time hand landmark detection using Google's MediaPipe Hand Landmarker task on Android. It processes a camera image stream via a JNI bridge and delivers hand coordinates asynchronously without blocking the UI thread.

AI-written summary of version 3.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need real-time hand tracking and landmark detection in a Flutter Android app
  • You want non-blocking inference running on a background thread to prevent UI jank
  • You want to bypass expensive JPEG compression using direct YUV to ARGB conversion

Skip it when

  • You need iOS support (only Android is supported)
  • You require synchronous detection calls (only asynchronous streaming via landmarkStream is supported)

Strengths

  • Non-blocking live tracking on a background thread
  • Configurable GPU or CPU delegate
  • Bundled MediaPipe hand_landmarker.task model requires no manual setup
  • Optimized JNI bridge with custom YUV to ARGB conversion

Weaknesses

  • Limited to the Android platform
  • Requires minimum Flutter SDK 3.44 and JDK 17

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
4

Requires Flutter SDK 3.44 or higher and JDK 17 or higher. The required MediaPipe model is bundled with the plugin.

import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
import 'package:hand_landmarker/hand_landmarker.dart';

class HandTrackerView extends StatefulWidget {
  const HandTrackerView({super.key});
  @override
  State<HandTrackerView> createState() => _HandTrackerViewState();
}

class _HandTrackerViewState extends State<HandTrackerView> {
  HandLandmarkerPlugin? _plugin;
  CameraController? _controller;
  bool _isInitialized = false;

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

  Future<void> _initialize() async {
    final cameras = await availableCameras();
    final camera = cameras.firstWhere(
      (cam) => cam.lensDirection == CameraLensDirection.front,
      orElse: () => cameras.first,
    );

    _controller = CameraController(
      camera,
      ResolutionPreset.medium,
      enableAudio: false,
    );

    _plugin = HandLandmarkerPlugin.create(
      numHands: 2,
      minHandDetectionConfidence: 0.7,
      delegate: HandLandmarkerDelegate.gpu,
    );

    await _controller!.initialize();
    await _controller!.startImageStream((image) {
      if (_isInitialized && _plugin != null) {
        _plugin!.processFrame(image, _controller!.description.sensorOrientation);
      }
    });

    if (mounted) {
      setState(() => _isInitialized = true);
    }
  }

  @override
  void dispose() {
    _controller?.stopImageStream();
    _controller?.dispose();
    _plugin?.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    if (!_isInitialized) {
      return const Center(child: CircularProgressIndicator());
    }
    return CameraPreview(_controller!);
  }
}

Alternatives

Packages that do the same job and could replace hand_landmarker.

Works with

Packages commonly used together with hand_landmarker: ones it builds on, ones built on it, and its own family.