This page shows you how to set up your development environment to use MediaPipe Tasks in your Flutter and Dart applications. Each task runs Google's MediaPipe runtime for the platform it runs on, and Google's pinned models are bundled with your app at build time.
Supported platforms and versions
To create Flutter applications with MediaPipe Tasks, your development environment requires the following:
- Flutter 3.44 or newer. The latest stable release is recommended. iOS and macOS builds with Xcode 27 need Flutter 3.47 or later.
- One or more of the following target platforms:
- Android 9 (API level 28) or higher
- iOS 15.0 or higher
- macOS 14.0 or higher on Apple Silicon
- Linux x64 or arm64
- Windows x64 or arm64
- Web
All tasks run on every platform listed above, with these exceptions: Text Proofreader and Text Summarizer are not yet available on the web, and Interactive Segmenter is not available on Windows. For other per-platform limits, see Platform notes.
MediaPipe Tasks dependencies
MediaPipe Tasks provides five Flutter packages for vision, text, audio,
retrieval, and decision tasks. Add only the packages your app uses: each one
bundles only the MediaPipe library for its domain. Every package depends on
mediapipe_core, which holds the shared model store and web runtime settings,
and re-exports its types, so you don't need to add mediapipe_core yourself.
Vision tasks
The MediaPipe Tasks vision package
(mediapipe_vision) contains tasks
that process images, video frames, and live camera streams (such as Face
Landmarker, Hand Landmarker, Pose Landmarker, Object Detector, and Image
Segmenter). See
Prepare vision input data for
supported inputs.
flutter pub add mediapipe_vision
Text tasks
The MediaPipe Tasks text package
(mediapipe_text) contains tasks
that analyze and embed text strings (such as Text Classifier, Language Detector,
and Text Embedder), plus Text Proofreader and Text Summarizer on platforms other
than the web.
flutter pub add mediapipe_text
Audio tasks
The MediaPipe Tasks audio package
(mediapipe_audio) contains tasks
that classify audio clips and streams, transcribe speech, and synthesize speech
(Audio Classifier, Audio Transcriber, and Text-to-Speech). See
Prepare audio input data for
supported inputs.
flutter pub add mediapipe_audio
Retrieval tasks
The MediaPipe Tasks retrieval package
(mediapipe_retrieval) provides
text, image, and audio embeddings in a shared embedding space and an on-device
vector index over them (Universal Embedder and Semantic Retriever).
flutter pub add mediapipe_retrieval
Decision tasks
The MediaPipe Tasks decision package
(mediapipe_decision) answers
yes-or-no, choice, and score questions about a text (Decision Maker).
flutter pub add mediapipe_decision
Bundle models
Apps bundle the models they use at build time, so nothing is downloaded at run time and the app works offline from its first launch.
In your app's
pubspec.yaml, declare theassets/mediapipe/folder and list the models each package uses underhooks.user_defines. Each package'sXxxModels.byName(for example,VisionModels.byName) lists the names it accepts.flutter: assets: - assets/mediapipe/ hooks: user_defines: mediapipe_vision: models: [face_landmarker, hand_landmarker] mediapipe_audio: models: [yamnet]From your app's root, download and verify the listed models. Run this command again whenever the list changes:
dart run mediapipe_core:bundle_modelsThe command downloads each listed model, checks it against its pinned SHA-256 hash, writes it into
assets/mediapipe/, and removes models that are no longer listed. Models download from Hugging Face (huggingface.coand its CDN,*.hf.co).In continuous integration, verify that the folder matches the list without changing it:
dart run mediapipe_core:bundle_models --check
Then create a task with the bundled model:
import 'dart:typed_data';
import 'package:mediapipe_vision/mediapipe_vision.dart';
Future<int> countFaces(Uint8List rgba, int width, int height) async {
final landmarker = await FaceLandmarker.create(
FaceLandmarkerOptions(model: VisionModels.faceLandmarker),
);
try {
final result = await landmarker.detect(
VisionImage.fromPixels(
pixels: rgba,
width: width,
height: height,
format: VisionPixelFormat.rgba,
),
);
return result.faceLandmarks.length;
} finally {
await landmarker.dispose();
}
}
If a model isn't bundled, create throws a RuntimeUnavailableException whose
fix names the pubspec.yaml entry to add. To use your own model, pass
modelPath or modelBytes in the task options instead of model.
Download models at run time
Downloading models at run time is opt-in. To let model: download models that
your app doesn't bundle, set ModelStore.allowDownloads before you create any
tasks:
ModelStore.allowDownloads = true;
Downloaded models are verified against the same pinned hashes and cached on the device. Run-time downloads need network access: see the Android, macOS, and Web notes in Platform notes.
Platform notes
Android
- Set
minSdkto 28 (Android 9) or higher inandroid/app/build.gradle(.kts). - Tasks run on arm64-v8a and x86_64. On 32-bit devices (armeabi-v7a), the vision tasks, Audio Classifier, and the Text Classifier, Text Embedder, and Language Detector tasks run on the CPU. Decision Maker, the retrieval tasks, EmbeddingGemma, Text Proofreader, Text Summarizer, Audio Transcriber, and Text-to-Speech require a 64-bit device.
- On the Android emulator, only the CPU delegate is available.
To download models at run time, add the
INTERNETpermission toandroid/app/src/main/AndroidManifest.xml. Flutter adds it only to debug and profile builds, so release builds need it explicitly:<uses-permission android:name="android.permission.INTERNET"/>
iOS
- Set the deployment target to iOS 15.0 or higher.
- On the iOS Simulator, only the CPU delegate is available.
- For App Store submission, declare the required-reason APIs that the
MediaPipe libraries call in your app's
ios/Runner/PrivacyInfo.xcprivacy. See App Store privacy manifest for the categories to declare.
macOS
- macOS 14.0 or higher on Apple Silicon is required.
Build the app for Apple Silicon only. Release and profile builds also build an Intel (x86_64) slice by default, which the MediaPipe libraries don't provide, so those builds fail. Add these lines to
macos/Runner/Configs/AppInfo.xcconfig:ARCHS = arm64 EXCLUDED_ARCHS = x86_64Alternatively, run
flutter config --enable-macos-arm64-onlyto apply the same setting to every app built on that machine.To download models at run time, a sandboxed app needs the network client entitlement in
macos/Runner/DebugProfile.entitlementsandmacos/Runner/Release.entitlements:<key>com.apple.security.network.client</key> <true/>
Linux
The MediaPipe Linux library loads EGL and OpenGL ES, even for CPU inference. On Debian, Ubuntu, or Raspberry Pi OS, install them with:
sudo apt-get install libegl1 libgles2Face Landmarker, Image Classifier, Image Segmenter, and Object Detector can run on the GPU through OpenGL ES with a hardware GPU driver. All other tasks run on the CPU.
Linux arm64 needs a 64-bit OS with glibc 2.27 or later and a Raspberry Pi 5-class CPU or newer. A Raspberry Pi 4 or older is not supported.
On Linux arm64, install Flutter from its git repository.
Windows
- Tasks run on the CPU; no GPU delegate is available.
- Interactive Segmenter is not available on Windows.
- On Windows arm64, install Flutter from its git repository in native ARM64 PowerShell.
Web
- By default, the MediaPipe JavaScript and WebAssembly runtimes load from jsDelivr, and each file is checked against a pinned SHA-384 hash before it runs. Bundled models load from your app's own assets.
To host the runtimes yourself (for offline use, an intranet, or a strict Content Security Policy), copy them into your app from its root:
dart run mediapipe_core:web_runtime web/mediapipeThen set the base URL before you create the first task:
MediaPipeWebRuntime.baseUrl = 'mediapipe/';If your site sends a Content Security Policy, allow
'self'andblob:inscript-srcandworker-src,'wasm-unsafe-eval'for WebAssembly, and'self'andhttps://cdn.jsdelivr.net(unless self-hosted) inconnect-src. Addhttps://huggingface.coand its CDN,https://*.hf.co, toconnect-srconly if you download models at run time.In the browser, Decision Maker and the retrieval tasks need
Delegate.gpuand a hardware WebGPU adapter. In WebKit (Safari and all iOS browsers), the retrieval tasks are unavailable and Decision Maker runs only with the Laya models. The GLiNER2.5-Decide models are not supported by any browser.
Samples and resources
- Live gallery: try every supported task in your browser.
- flutter-mediapipe on GitHub: source, the gallery app, code samples for every task, and a runnable object detection app for Android, iOS, macOS, Linux, Windows, and the web.
Troubleshooting
For help with technical questions related to MediaPipe, visit the discussion group or Stack Overflow for support from the community. To report bugs or make feature requests for the Flutter packages, file an issue on GitHub.