Search packages, repositories and app categories

Package detailsv4.1.0

console

A library for common features required by console applications, including color formatting, keyboard input, and progress bars.

AndroidiOSmacOSWindowsLinux
30-day downloads
380K
Likes
70
Pub points
120

Install package

flutter pub add console

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The console package provides essential utilities for building command-line applications in Dart and Flutter. It offers features like colored text output, interactive keyboard input handling, and progress bar visualization. Designed for CLI developers, it simplifies terminal interactions with clean, cross-platform APIs. The library supports multiple platforms including Android, iOS, macOS, Windows, and Linux, making it ideal for tools that run outside the UI environment. Its lightweight nature and focus on developer experience make it a practical choice for scripting, automation, and console-based workflows.

Use cases

  • Building CLI tools
  • Interactive terminal applications
  • Progress tracking in scripts
  • Colorized logging
  • Command-line user input handling

Key features

  • Color formatting support
  • Keyboard input utilities
  • Progress bar components
  • Cross-platform compatibility
  • Simple API design

Suitable for

  • CLI developers
  • Scripting tools
  • Automation workflows
  • Terminal-based interfaces
  • Dart/Flutter console apps

Considerations

  • Limited to console environments
  • No GUI integration
  • Requires terminal access
  • Platform-specific behavior possible
  • Not for web or mobile UIs

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Console

A high-level console library.

Features

  • Console Colors (ANSI)
  • Icons (UTF-8)
  • Keyboard Capture
  • Experimental Clipboard Support
  • Progress Bars
  • Flexible Prompts
  • Shell Prompts
  • Choosers
  • Fancy Formatting
  • Loading Bars
  • Timer (like pub's timer)
  • Fancy Trees (like the npm dependency trees)
  • Simple Unit Testing

Usage

This library does not work in browsers (for a hopefully obvious reason).

import "package:console/console.dart";

void main() {
  // Initialize the Console. Throws an exception if advanced terminal features are not supported.
  Console.init();
  
  // Use the library...
}

Unit Testing

You can test the output produced by this library (and thus your own project that uses this library). Here is an example:

import "package:test/test.dart";
import "package:console/console.dart";

void main() {
  final output = new BufferConsoleAdapter();

  setUpAll(() => Console.adapter = output);

  // Clear output between test runs
  setUp(() => output.clear());

  group('base functions', () {
    test('centerCursor', () {
      Console.centerCursor();
      expect(output.toString(), '${Console.ANSI_ESCAPE}10;40H');
    });
  });
}

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package