v2.0.1
dolumns
一個用於將文字輸出格式化為欄位的 Dart 庫。適用於在終端中列印表格資料。
22喜歡 1900近 30 天下載145Pub 分數
AndroidiOSWebmacOSWindowsLinux
一個用於將文字輸出格式化為欄位的函式庫。
^1.11.1^1.24.2以下為英文專案原文快照,最新內容請造訪 GitHub。
A library for formatting text output into columns.
Dart CI
A simple usage example:
import 'package:dolumns/dolumns.dart';
main() {
final columns = dolumnify([
['provider', '4.0.2'],
['http', '0.12.0+4'],
['shared_preferences', '0.5.6+1'],
['sentry', '3.0.1'],
]);
print(columns);
}
will output:
provider 4.0.2
http 0.12.0+4
shared_preferences 0.5.6+1
sentry 3.0.1
You can also supply a custom column splitter, (...], columnSplitter: ' | '); will give:
provider | 4.0.2
http | 0.12.0+4
shared_preferences | 0.5.6+1
sentry | 3.0.1
Columns with headers are possible with a custom header separator, provide the header in the first list item:
import 'package:dolumns/dolumns.dart';
main() {
final columns = dolumnify([
['PACKAGES', 'VERSION'],
['provider', '4.0.2'],
['http', '0.12.0+4'],
['shared_preferences', '0.5.6+1'],
['sentry', '3.0.1'],
], columnSplitter: ' | ', headerIncluded: true, headerSeparator: '=');
print(columns);
}
will output:
PACKAGES | VERSION
=============================
provider | 4.0.2
http | 0.12.0+4
shared_preferences | 0.5.6+1
sentry | 3.0.1
see dolumns_example.dart example file for full details.
Note you can pass in objects of any type, dolumn will call toString() on every object passed in.
API inspired by the columinfy npm package.
Please file feature requests and bugs at the issue tracker.