🧠 Introduction
The Dart ecosystem is growing fast — especially with Flutter. But when it comes to native machine learning (ML) capabilities inside Dart itself, the resources are almost nonexistent.
To address this gap, I’ve started developing a set of lightweight, native, and open-source machine learning packages in Dart. And now, the first two are officially published on pub.dev:
-
ml_knn
: A K-Nearest Neighbors classifier -
ml_logistic_regression
: A Logistic Regression model
📦 What’s Available
1. ml_knn
: K-Nearest Neighbors in Pure Dart
Use Cases:
- Simple classification
- Anomaly detection
- Recommendation systems
Installation:
dependencies:
ml_knn: ^1.0.0
Usage:
final model = KNN(k: 3);
model.fit([[1.0, 2.0], [2.0, 3.0], [3.0, 4.0]], ['A', 'B', 'B']);
final prediction = model.predict([[2.5, 3.5]]);
print(prediction); // ['B']
✅ Fully written in Dart
✅ Unit-tested and published on pub.dev
✅ Offline & mobile-friendly
2. ml_logistic_regression
: Logistic Regression in Dart
Use Cases:
- Binary classification
- Probability-based predictions
- Linear decision boundaries
Installation:
dependencies:
ml_logistic_regression: ^1.0.0
Example:
final model = LogisticRegression(
learningRate: 0.1,
iterations: 1000,
regularization: 0.01,
);
model.fit([[0, 0], [1, 1]], [0, 1]);
final prediction = model.predict([[0.5, 0.5]]);
print(prediction); // [0] or [1]
🧪 The model is validated with logical gate (AND) prediction tests
📈 All training is done natively in Dart – no Python, no API, no external libs.
🌱 Roadmap
This is just the beginning. Here's what I'm building next:
Package | Status | Description |
---|---|---|
ml_knn |
✅ Live | K-Nearest Neighbors (classification) |
ml_logistic_regression |
✅ Live | Logistic regression |
ml_fuzzy_matcher |
🚧 In Progress | AI-powered string similarity |
ml_naive_bayes |
🔜 Planned | Naive Bayes Classifier |
ml_linear_regression |
🔜 Planned | Linear regression |
ml_kmeans |
🔜 Planned | Unsupervised clustering |
ml_fin_scorer |
🔜 Planned | AI-powered financial scoring |
🚀 Eventually, all will be part of a complete framework:
ml_flutter_basics
🔍 Why Native ML in Dart?
- No need to host an API or use Python backends
- Works offline, ideal for mobile apps
- Seamless experience inside the Flutter ecosystem
- Lightweight and fast to prototype in Dart
🤝 Contribute or Collaborate
I’m actively maintaining these projects and open to contributions!
- GitHub: github.com/CelkMehmett
- Pub.dev:
ml_knn
,ml_logistic_regression
✨ If you like the project, please give it a star!
💬 Issues, ideas, PRs — all are welcome.
📢 Final Thoughts
Machine learning in Dart should be accessible, lightweight, and usable in real-world apps — without always needing to call an external service or switch languages.
I’ll keep building these tools and sharing them publicly.
Thanks for reading!
Let’s make Dart smarter — together.
🙋♂️ About Me
I'm a Flutter & AI developer building native ML tools in Dart.
Also working on productivity apps like MergeNius, GreenPact, and more.
Building in public. Open to collaboration.
Let’s connect!