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.
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.
- google_mlkit_face_mesh_detection
Flutter plugin for Google's ML Kit Face Mesh Detection to generate 3D face meshes.
83Compare - google_ml_kit
Umbrella Flutter plugin for Google's standalone ML Kit APIs.
86Compare - google_mlkit_pose_detection
Flutter plugin for Google ML Kit Pose Detection on Android and iOS.
88Compare - google_mlkit_object_detection
Detect and track objects in images or live camera feeds using Google's ML Kit.
87Compare
Works with
Packages commonly used together with hand_landmarker: ones it builds on, ones built on it, and its own family.
- plugin_platform_interfacehand_landmarker depends on itReusable base class for platform interfaces of Flutter federated plugins.
- jnihand_landmarker depends on itProvides Dart/Flutter bindings to call native Java code via JNI.
- jni_flutterhand_landmarker depends on itAccess Flutter Android APIs from Dart.
- camerahand_landmarker depends on itFlutter plugin to preview, capture photos/video and stream camera images.