Open source · Dart & Flutter · v0.1.4

LaTeX math, in pure Dart.

A TeX engine that lays formulas out by TeX's rules, and Flutter widgets that draw them — one formula, math inside a sentence, or an AI reply while it is still streaming in.

$flutter pub add val_latex_flutter
Read the docs pub.dev
reply.mdmd
rendering…val_latex
math text rendered by val_latex
DemoReal renders
val_latex_flutter · 30 days
60.2K
val_latex · 30 days
61.1K
Commands it knows
4,429
Environments
88

From pub.dev, 2026-11-13. Downloads count installs, not people. Commands and environments are counted from the engine's own catalog.

01 · Streaming

Formulas grow as the reply arrives.

MathText renders an AI reply while it streams in. Nothing half-typed ever flashes on screen.

  • A formula that is still open renders as far as it has come.
  • A dangling $, $$ or \[ is held back; $5 stays a price.
  • One widget for the whole reply: text and math together.
Streaming
02 · Layout

Long formulas fit any screen.

A display formula too long for the screen breaks into lines at relations and operators, aligned under the first =. Drag the width and watch it re-flow.

  • No settings: Math.tex wraps on its own.
  • What cannot break scrolls, shrinks or clips: your choice.
Wrapping and overflow
The formula laid out in 392 pixels
NarrowWide
392 px. The orange rule marks the edge.
03 · Speech

It reads math aloud.

The engine turns any formula into words for screen readers, voice assistants and text-to-speech, at three levels of detail. Pick a formula, change the detail, and listen.

Quadratic formula, typeset by val_latex
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
“x equals the fraction with numerator minus b plus or minus the square root of b squared minus 4 a c end root and denominator 2 a end fraction”

toSpeech(parseLatex(tex), verbosity: SpeechVerbosity.normal), run on this formula when the page was built.

04 · Coverage

Real TeX, not a subset.

4,429 commands and 88 environments: amsmath, chemistry, physics, diagrams, arrays and more. Pick one to see the Flutter code and what it draws.

Fluttermath.dart
import 'package:flutter/widgets.dart';
import 'package:val_latex_flutter/val_latex_flutter.dart';

/// An inline formula, then the same kind of formula in display style:
/// centred, with large operators and an equation number at the margin.
Widget example() => const Column(
  crossAxisAlignment: CrossAxisAlignment.start,
  children: [
    Math.tex(r'x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}'),
    SizedBox(height: 12),
    Math.tex(
      r'\sum_{n=1}^{\infty} \frac{1}{n^2} = \frac{\pi^2}{6} \tag{1}',
      displayMode: true,
    ),
  ],
);
Rendered by val_latexFormulas docs
Formulas, rendered from the flutter on the left

Each render is made from the code beside it, at 18 px.

Two libraries

Flutter widgets, and the Dart engine under them.

The widgets: Math.tex for a formula, MathText for math inside text and streaming replies, with selection, taps and screen readers.

$ flutter pub add val_latex_flutter

The engine: parse, lay out, find formulas in text, speak them, normalise them. On the Dart VM, on servers and compiled to JavaScript.

$ dart pub add val_latex

A Flutter app adds val_latex_flutter only; it includes the engine.

server.dart
import 'package:val_latex/val_latex.dart';

final result = parseLatex(r'\frac{a+1}{b}');

toSpeech(result);
// the fraction with numerator a plus 1 and denominator b end fraction

toLatex(parseLatex('α ≤ x²'), ascii: true);
// \alpha\le x^{2}
The Dart engine

What comes next

Text is the first step. Ask below: the same answer becomes an interface, then a live scene.

Loading demo
  1. 01 · FreeThis page

    Output Rendering

    Markdown, math and code that render while the answer streams.

  2. 02 · Early accessNext step

    Generative UI

    Your team designs the components. The model fills them in. Your app draws them.

    How it works
  3. 03 · Private beta

    Live Scenes

    The answer as a narrated scene that people can steer and act on.

    How it works

Asked
first.

The short version for teams choosing a math renderer.

Typeset it properly.

Start with one widget; the docs cover the widgets, their options and the full API.

Read the docs