๐ง 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!
Top comments (0)