console 2.0.1 copy "console: ^2.0.1" to clipboard
console: ^2.0.1 copied to clipboard

outdatedDart 1 only

Console Power Library

Console #

A Console Library for Epicness

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.
  Terminal.init();
  
  // Use the library.
}

Unittesting #

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

library somelib.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"));
    });
  });
}
66
likes
0
pub points
88%
popularity

Publisher

unverified uploader

Console Power Library

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on console