tabular 0.2.1-alpha copy "tabular: ^0.2.1-alpha" to clipboard
tabular: ^0.2.1-alpha copied to clipboard

outdated

Dart library for easily displaying tabular data in a visually appealing ASCII table format.

example/example.dart

import 'package:tabular/tabular.dart';

void main() {
  var data = [
    ['Season', '#', 'Name', 'Days', 'Sun'],
    ['Winter', 1, 'January', 31, 94],
    ['Winter', 2, 'February', 28, 123],
    ['Spring', 3, 'March', 31, 42],
    ['Spring', 4, 'April', 30, 243],
    ['Spring', 5, 'May', 31, 5523],
    ['Summer', 6, 'June', 30, 11251],
    ['Summer', 7, 'July', 31, 17451],
    ['Summer', 8, 'August', 31, 18707],
    ['Autumn', 9, 'September', 30, 7025],
    ['Autumn', 10, 'October', 31, 5041],
    ['Autumn', 11, 'November', 30, 2302],
    ['Winter', 12, 'December', 31, 258],
  ];

  String title(s) => '\n\n$s\n';

  print(title('JUST TABLE'));
  print(tabular(data));

  print(title('WITH BORDER'));
  print(tabular(data, outerBorder: true));

  print(title('WITH MARKDOWN ":"'));
  print(tabular(data, markdownAlign: true));

  print(title('WITH MODIFIED ALIGNMENT'));
  print(tabular(data, align: {'Name': Side.center, 'Sun': Side.start}));

  print(title('WITH CUSTOM FORMATTING'));
  print(tabular(data, format: {
    'Name': (value) => value.toUpperCase(),
    'Sun': (value) => '+ ' + value.toString()
  }));

  print(title('SORTED BY FIRST COLUMN'));
  print(tabular(data, sort: [Sort(0)]));

  print(title('SORTED BY TWO COLUMNS "DAYS" AND "SUN"'));
  print(tabular(data, sort: [Sort('Days', ascending: false), Sort('Sun')]));
}
15
likes
0
points
44
downloads

Publisher

verified publisherrevercode.com

Weekly Downloads

Dart library for easily displaying tabular data in a visually appealing ASCII table format.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

quiver

More

Packages that depend on tabular