tflite_web
0.4.0, released 12 months ago by appgozar.com
Run TensorFlow Lite models in the browser using WebAssembly.
What it does
Provides a Dart API to load TensorFlow Lite models via TFLite JS/WASM and run inference in a web environment. Models can be loaded from URLs or memory and predictions are returned as tensors.
AI-written summary of version 0.4.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need on‑device ML inference in a Flutter web app
- You want to avoid native plugins and keep everything in the browser
Skip it when
- You target mobile or desktop where native tflite_flutter offers better performance
- You require GPU‑accelerated inference not available in WASM
Strengths
- Runs purely in the browser, no native code
- Supports loading scripts from a CDN or custom hosting
- WASM backend gives reasonable performance for many models
Weaknesses
- Limited to web platforms only
- Performance may be lower than native implementations
- API changed in 0.4.0 (breaking change)
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Call TFLiteWeb.initializeUsingCDN() (or initialize() for custom scripts) before loading models; add the 'web' dependency in pubspec.
await TFLiteWeb.initializeUsingCDN();
final model = await TFLiteModel.fromUrl('model_url');
final input = Tensor(data, shape, dataType);
final outputs = model.predict(input);Alternatives
Packages that do the same job and could replace tflite_web.
- tflite_flutter
Native Flutter plugin for mobile/desktop with better performance and broader platform support
68Compare
Works with
Packages commonly used together with tflite_web: ones it builds on, ones built on it, and its own family.