console 2.2.4

  • README.md
  • Installing
  • Versions
  • 67

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:

library someproject.test;

import 'package:unittest/unittest.dart';
import 'package:console/console.dart';

void main() {

  // Configures Terminal to use a StringBuffer() instead of stdout.
  var output = useStringStdout();
  output.terminalColumns = 80;
  output.terminalLines = 20;

  // makes sure to clear output between test runs
  setUp(() => output.clear());

  group('base functions', () {
    test('centerCursor', () {
      Terminal.centerCursor();
      expect(output.str, equals(Terminal.ANSI_ESCAPE + "10;40H"));
    });
  });
}

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  console: "^2.2.4"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:console/console.dart';
        
Version Uploaded Documentation Archive
2.2.4 Aug 17, 2016 Go to the documentation of console 2.2.4 Download console 2.2.4 archive
2.2.3 Apr 22, 2015 Go to the documentation of console 2.2.3 Download console 2.2.3 archive
2.2.2 Apr 19, 2015 Go to the documentation of console 2.2.2 Download console 2.2.2 archive
2.2.0 Feb 2, 2015 Go to the documentation of console 2.2.0 Download console 2.2.0 archive
2.1.0 Dec 4, 2014 Go to the documentation of console 2.1.0 Download console 2.1.0 archive
2.0.3 Nov 30, 2014 Go to the documentation of console 2.0.3 Download console 2.0.3 archive
2.0.2 Nov 30, 2014 Go to the documentation of console 2.0.2 Download console 2.0.2 archive
2.0.1 Nov 28, 2014 Go to the documentation of console 2.0.1 Download console 2.0.1 archive
2.0.0 Nov 28, 2014 Go to the documentation of console 2.0.0 Download console 2.0.0 archive
1.1.2 Nov 18, 2014 Go to the documentation of console 1.1.2 Download console 1.1.2 archive

All 13 versions...

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • tool failures on Feb 16, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
68 / 100
Health:
Code health derived from static analysis. [more]
87 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
34 / 100
Overall score:
Weighted score of the above. [more]
67

Platforms

Detected platforms: Flutter, other

Primary library: package:console/console.dart with components: io.

Suggestions

  • Fix lib/src/base.dart.

    Strong-mode analysis of lib/src/base.dart failed with the following error:

    line: 216 col: 40
    The argument type 'List' can't be assigned to the parameter type 'Iterable<int>'.

  • Fix lib/src/canvas.dart.

    Strong-mode analysis of lib/src/canvas.dart failed with the following error:

    line: 27 col: 14
    A value of type 'PixelSpec' can't be assigned to a variable of type 'int'.

  • Fix further 1 Dart files.

    Similar analysis of the following files failed:

    • lib/clut.dart
  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Fix issues reported by dartanalyzer.

    dartanalyzer reported 3 error(s) and 0 warning(s).

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use console.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.14.0
vector_math >=1.4.3 <2.0.0 1.4.7 2.0.5
Transitive dependencies
matcher 0.12.1+4
path 1.5.1
quiver 0.22.0 0.28.0
stack_trace 1.9.2
Dev dependencies
test >=0.12.0 <0.13.0