Skip to content
pubscout

hand_detection

4.3.2, released 7 days ago by hugo.ml

On‑device hand detection, landmarks and gesture recognition using LiteRT models.

WASM-ready
$ flutter pub add hand_detection
Source repository

What it does

The package runs MediaPipe hand detection locally, returning 21‑point 3D landmarks, handedness and a set of predefined gestures. It works on mobile, desktop and web without any remote API.

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

Use it when

  • You need offline hand tracking on multiple platforms
  • You require 3D hand landmarks and built‑in gesture classification
  • You want GPU/NPU acceleration where available

Skip it when

  • You prefer a pure Dart solution without native OpenCV dependencies
  • You target very old devices or browsers without WebGPU support

Strengths

  • Fully offline, no network calls
  • Cross‑platform: Android, iOS, macOS, Windows, Linux, Web
  • Supports GPU/NPU via LiteRT for better performance
  • Provides ready‑made gesture labels

Weaknesses

  • Requires native libraries (opencv_dart, dartcv4) and specific Flutter/Dart versions
  • Setup can be complex (hooks, iOS deployment target, native linking)
  • Web support limited to WebGPU

Setup

Kind
Plugin (native code)
Effort
High
Code generation
No
Direct dependencies
6

Requires Dart 3.10+ and Flutter 3.47.5+. Add hooks user_defines for iOS deployment target (>=15.0). Ensure native dependencies (opencv_dart, dartcv4) are compiled for each platform. Include camera_desktop for desktop camera use. May need to run flutter clean after changes.

import 'dart:io';
import 'package:hand_detection/hand_detection.dart';

Future<void> main() async {
  final detector = await HandDetector.create();
  final bytes = await File('path/to/image.jpg').readAsBytes();
  final hands = await detector.detect(bytes);
  for (var hand in hands) {
    print('Handedness: ${hand.handedness}');
    if (hand.hasLandmarks) {
      final wrist = hand.getLandmark(HandLandmarkType.wrist);
      print('Wrist: (${wrist?.x}, ${wrist?.y})');
    }
  }
  await detector.dispose();
}

Alternatives

Packages that do the same job and could replace hand_detection.

  • tflite_flutter

    Provides a lower‑level TFLite API without the heavy OpenCV and LiteRT stack, suitable for simpler models or when you want full control over inference.

  • google_mlkit_commons

    Offers Google‑backed ML Kit APIs with easier setup on mobile, though it relies on Google services and may not support desktop/web.

Works with

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