Skip to content
pubscout

dart_console

5.1.2, released 4 weeks ago by onepub.dev

A helper library for command-line applications requiring advanced control over input/output.

$ flutter pub add dart_console
Source repository

What it does

Provides control over console window dimensions, cursor location, colors, raw input mode, and tabular data display. It includes features for reading control sequences, handling East Asian character widths, and streaming key input asynchronously.

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

Use it when

  • Building command-line applications or REPLs in Dart
  • Needing raw keyboard input processing or cursor manipulation
  • Displaying formatted tabular data or calendars in the terminal

Skip it when

  • Developing graphical user interface (GUI) or mobile applications
  • Building web-only applications

Strengths

  • Supports raw terminal mode and advanced keyboard input processing
  • Cross-platform support for Windows, macOS, and Linux
  • Includes built-in support for table rendering and calendar display

Weaknesses

  • Requires a terminal that recognizes and implements common ANSI escape sequences
  • Platform-specific bindings rely on FFI and the win32 package on Windows

Setup

Kind
FFI (native library)
Effort
Low
Code generation
No
Direct dependencies
4

Not documented

import 'package:dart_console/dart_console.dart';

main() {
  final console = Console();

  console.clearScreen();
  console.resetCursorPosition();

  console.writeLine(
    'Console size is \${console.windowWidth} cols and \${console.windowHeight} rows.',
    TextAlignment.center,
  );

  console.writeLine();

  return 0;
}

Alternatives

Packages that do the same job and could replace dart_console.

  • cli_util

    Utilities to help build Dart command-line apps, find the SDK, and display progress.

  • cli_tools

    Utilities for building command‑line interfaces, including argument parsing, analytics, and progress reporting.

  • icons_launcher

    A command-line tool that simplifies updating your Flutter app launcher icon.

  • bosun

    Library for parsing CLI input and structuring commands

Works with

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