Model or dataset
davidmigloz/langchain_dart avatar
davidmigloz/langchain_dart

LangChain.dart: an unofficial Dart port for LLM apps in Flutter

Build LLM-powered Dart/Flutter applications.

688 stars155 forksDartMIT

At a glance

What is it?
LangChain.dart brings the LangChain component model to Dart and Flutter through a modular set of pub.dev packages. It is useful when your LLM logic has to live inside the app, and awkward when it does not.
Who is it for?
Adopt LangChain.dart if your LLM calls must run inside a Dart or Flutter process and you want LangChain's abstraction set rather than a provider SDK. Do not adopt it if you need parity with the Python or JavaScript LangChain APIs, or if a server-side Python service is acceptable.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly Dart, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The gap LangChain.dart is trying to fill

The README states the motivation directly: emerging LLM libraries and tools are predominantly built for the Python and JavaScript ecosystems, and the Dart and Flutter ecosystem has not seen comparable growth, which the project attributes to a scarcity of Dart and Flutter libraries that handle LLM complexity. LangChain.dart is the response. It is an unofficial Dart port of LangChain, the Python framework created by Harrison Chase, and it targets developers who want the same component vocabulary (prompt templates, output parsers, retrievers, agents) inside an app written in Dart.

That framing matters for who should read further. A Flutter developer building a chat interface, a summarizer, or a retrieval-augmented question-answering screen currently has two options: call a provider's HTTP API by hand, or put the orchestration in a backend written in another language. LangChain.dart exists for the first group and competes with the second. If your architecture already has a Python service in front of the model, this library adds a second place where prompt logic lives.

The package split: core, langchain, community and integrations

The repository is a monorepo. The README describes a modular design with four layers. langchain_core holds the core abstractions plus the LangChain Expression Language (LCEL) used to compose them, and the README says to depend on it if you are building a framework on top of LangChain.dart or interoperating with it. The langchain package holds higher-level chains, agents and retrieval algorithms, and it re-exports langchain_core, so applications depend on langchain alone. langchain_community collects third-party integrations and community-contributed components that are not part of the core API. Integration-specific packages sit outside both: langchain_openai, langchain_google, langchain_ollama and others, so that importing one provider does not pull in the rest of langchain_community.

The README groups the components into three modules. Model I/O is the unified API across providers plus prompt templates, example selectors and output parsers. Retrieval covers document loaders, text splitters, embedding models, vector stores and retrievers, which together ground a model's answers. Agents are described as bots that use an LLM to decide which tools to call, with web search, calculators and database lookup given as examples.

The practical consequence of this layout is that your pubspec.yaml is where the architecture decision gets made. Adding langchain_google does not give you Chroma; adding langchain_chroma does not give you an embedding provider. The README's package table lists the available integrations, and it is the list to check before designing around a vector store or a model vendor.

The LCEL layer is the part most likely to feel unfamiliar. It is a composition mechanism, and the README points to a get_started page under expression_language rather than documenting the syntax inline. Treat that documentation page as required reading, not optional.

Installing LangChain.dart and running a first chain

The README does not include an install section; it points to pub.dev for each package, and the repository ships runnable projects under examples/, including hello_world_cli, hello_world_flutter, hello_world_backend, browser_summarizer and wikivoyage_eu. The package name to depend on is langchain, which exposes langchain_core. Add it with the Dart CLI, then fetch dependencies:

bash
dart pub add langchain
dart pub get

If you also need a provider integration, add that package separately. For a local model served by Ollama, the README lists langchain_ollama as its own package:

bash
dart pub add langchain_ollama

After that, the fastest way to see a working call is to open the closest example rather than writing from scratch. The repository keeps a CLI example and a Flutter example, and the docs_examples project is the one the documentation site is generated from, so it tracks the current API surface more closely than a hand-written snippet would. Run the CLI example from its own directory with dart run, and expect console output from the model provider you configured. The README does not document the environment variables or credential setup for each provider, so check the example's own files for those.

One thing to expect on the first run: a missing or wrong API key surfaces as a provider-level error from the integration package, not as a LangChain.dart error, because the integration packages wrap the underlying Dart API clients. The repository contains an API_CLIENT_ALIGNMENT_GUIDE.md at the top level, which is a signal that the client wrappers are maintained against a shared convention.

Where the port stops being a drop-in

The README calls this an unofficial port, and that word carries the main limitation. Nothing in the README claims API parity with the Python or JavaScript LangChain releases. A pattern you know from Python may exist here under a different shape, may live in langchain_community instead of langchain, or may not be ported at all. Version numbers reinforce this: the release list shows langchain-v0.9.0 in August 2026, while the Python project's versioning has moved on its own schedule.

The packaging model is the second constraint. Because integrations are split into separate packages, a provider that has not been published as its own package is reachable only through langchain_community, if at all. That is a deliberate trade-off in favor of small dependency trees, and it means the set of supported vector stores and model vendors is whatever the maintainers and contributors have published, not whatever exists in the Python ecosystem.

There is also the question of where the code runs. LangChain.dart is a Dart library, so it fits a Flutter app, a Dart CLI, or a Dart backend. Putting model credentials in a client-side Flutter binary is a different risk profile from keeping them on a server, and the library does not change that. If your prompts and keys belong on a server, a Python service is the simpler answer, and LangChain.dart becomes unnecessary indirection.

Finally, the README does not document rollback, deprecation policy or a migration path between major versions. The CHANGELOG.md at the repository root is the only place to look for that.

LangChain.dart compared with calling a provider SDK directly

The realistic alternative for most Dart and Flutter teams is not another orchestration framework, it is the provider's own Dart client. The repository itself contains googleai_dart, published as googleai_dart-v3.0.0 in December 2025, which is a Dart client for Google's generative AI API. That is the lower-level option: you call the API, you handle the prompt string, you parse the response.

The difference is what you get for the extra dependency. With a provider client you write the prompt, the retry, the parsing and the retrieval loop yourself, and you are tied to that vendor's request and response shapes. With LangChain.dart you get a provider-agnostic interface, prompt templates, output parsers and the retrieval components, at the cost of learning LCEL and of living with a port that trails the reference implementation.

A second alternative worth naming is Genkit Dart, which appears in the related searches for this project, meaning people are comparing the two. The README here does not describe Genkit's design, so the honest comparison is limited to positioning: LangChain.dart's stated goal is to port LangChain's component set to Dart, while Genkit is a separate framework with its own abstractions. If you are choosing between them, evaluate Genkit's documentation on its own terms rather than assuming the component names map across.

The choice usually comes down to one question. If you want the LangChain mental model and you are writing Dart, this is the only project described in the README that offers it. If you want the smallest possible dependency and one provider, the provider client wins.

Maintenance, licensing and what to check before upgrading

The repository is not archived, and its last push was on 2026-09-07. The most recent release listed is langchain-v0.9.0 on 2026-08-27, with googleai_dart-v3.0.0 on 2025-12-27 and googleai_dart-v2.1.0 on 2025-12-23 before it. The versioning is per package, so an upgrade is never a single decision: langchain, langchain_core, langchain_community and each integration package move independently, and a breaking change in a provider client can land without a matching langchain release.

That has a concrete cost. Before upgrading, read CHANGELOG.md at the repository root, and check the pub.dev page for each package you actually depend on, including transitive ones. If you pin loosely, a provider package can move a major version underneath you; the jump from googleai_dart v2 to v3 is the kind of change that deserves a look at the changelog before it reaches your lockfile.

The licence is MIT, stated in the README badge and present as a LICENSE file at the repository root. MIT permits commercial use, modification and redistribution provided the copyright notice and permission notice are kept. That is the general shape of the licence, not advice about your situation; if you are redistributing a Flutter app or embedding the library in a product with its own legal constraints, read the LICENSE file itself and take your own counsel.

One maintenance detail the repository makes visible: it carries an API_CLIENT_ALIGNMENT_GUIDE.md and a CONTRIBUTING.md, so there is a documented convention for the client wrappers and a stated path for contributions. Neither document is summarized in the README, so read them at the source.

Editorial conclusion

Adopt LangChain.dart if your LLM calls must run inside a Dart or Flutter process and you want LangChain's abstraction set rather than a provider SDK. Do not adopt it if you need parity with the Python or JavaScript LangChain APIs, or if a server-side Python service is acceptable. Before committing, verify that the package you need exists on pub.dev under the name shown in the README table, and check the changelog for langchain-v0.9.0 to see which abstractions moved since the version you plan to pin.

Frequently asked questions

Is LangChain.dart an official LangChain project?

No. The README describes it as an unofficial Dart port of the LangChain Python framework created by Harrison Chase, and the repository is maintained under davidmigloz/langchain_dart.

Which package should I add to a Flutter project to build LLM applications with LangChain.dart?

The README says to depend on the langchain package to build LLM applications, and notes that it exposes langchain_core so you do not need to depend on that package explicitly. Provider integrations such as langchain_openai, langchain_google and langchain_ollama are separate packages you add only when you need them.

Does LangChain.dart work with Ollama?

Yes. The README lists langchain_ollama as one of the integration-specific packages, and Ollama is named among the LLM providers covered by the unified Model I/O API.

What is the licence for LangChain.dart?

MIT, according to the licence badge in the README and the LICENSE file at the repository root. That permits commercial use and modification as long as the copyright and permission notices are retained.

Official sources

  1. davidmigloz/langchain_dart on GitHub
  2. License: MIT
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/davidmigloz-langchain-dart.svg)](https://hysenlabs.com/projects/davidmigloz-langchain-dart)