Skip to content
pubscout

dart_tui

3.0.0, released 5 weeks ago by hashstudios.dev

Elm-style terminal UI framework for Dart with Model–Update–View architecture.

$ flutter pub add dart_tui
Source repository

What it does

Builds interactive CLI applications and terminal user interfaces using an Elm-style Model–Update–View architecture. Includes async commands, over 27 ready-made components, spring animations, and Lipgloss-inspired styling.

AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to build a rich, interactive command-line or terminal application in Dart
  • You prefer an Elm-style state management and rendering flow for your CLI app

Skip it when

  • You are building a traditional graphical user interface for mobile, web, or desktop
  • You only need to print basic console output without an interactive event loop

Strengths

  • Clean, testable Model–Update–View architecture
  • Rich set of 27+ ready-made components and Lipgloss-inspired styling utilities
  • Cell-level diff renderer for zero-flicker updates

Weaknesses

  • Limited to terminal and CLI environments
  • Requires handling terminal control keys and raw mode specifics

Setup

Kind
FFI (native library)
Effort
Low
Code generation
No
Direct dependencies
3
import 'package:dart_tui/dart_tui.dart';

void main() async {
  await Program(
    options: [withAltScreen()],
  ).run(CounterModel());
}

final class CounterModel extends Model {
  CounterModel({this.count = 0});
  final int count;

  @override
  Cmd? init() => tick(const Duration(seconds: 1), (_) => _TickMsg());

  @override
  (Model, Cmd?) update(Msg msg) {
    if (msg is _TickMsg) {
      if (count >= 5) return (this, () => quit());
      return (CounterModel(count: count + 1),
          tick(const Duration(seconds: 1), (_) => _TickMsg()));
    }
    if (msg is KeyMsg && (msg.key == 'q' || msg.key == 'ctrl+c')) {
      return (this, () => quit());
    }
    return (this, null);
  }

  @override
  View view() => newView('Count: $count\n\nPress q to quit.');
}

final class _TickMsg extends Msg {}

Alternatives

Packages that do the same job and could replace dart_tui.

  • nocterm

    Framework for building terminal user interfaces with Flutter‑like components and hot reload.

  • flutter_sliding_toast

    Displays customizable sliding and popup toasts with animations, queueing, and stacking modes.

  • tabbed_view

    Flutter widget inspired by the classic Desktop-style tab component.

  • rubber

    Elastic bottom sheet widget with customizable spring animation.

Works with

Packages commonly used together with dart_tui: ones it builds on, ones built on it, and its own family.