p-hatan/ mirror

pub repository

mirror.p-hatan.ir

term_glyph

1.0.0

Useful glyphs and Windows-safe equivalents.

Download archive

Readme

This library contains getters for useful Unicode glyphs as well as plain ASCII alternatives. It's intended to be used in command-line applications that may run on Windows and libraries that may be used by those applications.

We recommend that you import this library with the prefix "glyph". For example:

import 'package:term_glyph/term_glyph.dart' as glyph;

/// Formats [items] into a bulleted list, with one item per line.
String bulletedList(List<String> items) =>
    items.map((item) => "${glyph.bullet} $item").join("\n");

ASCII Mode

The default Windows cmd.exe shell is unable to display Unicode characters, so this package is able to transparently switch its glyphs to ASCII alternatives by setting the ascii attribute. When this attribute is true, all glyphs use ASCII characters instead. It currently defaults to false, although in the future it may default to true for applications running on the Dart VM on Windows. For example:

import 'dart:io';

import 'package:term_glyph/term_glyph.dart' as glyph;

void main() {
  glyph.ascii = Platform.isWindows;

  // Prints "Unicode => ASCII" on Windows, "Unicode ━▶ ASCII" everywhere else.
  print("Unicode ${glyph.rightArrow} ASCII");
}

All ASCII glyphs are guaranteed to be the same number of characters as the corresponding Unicode glyphs, so that they line up properly when printed on a terminal. The specific ASCII text for a given Unicode glyph may change over time; this is not considered a breaking change.

Changelog

1.0.0

  • Initial version.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add term_glyph
pubspec.yaml
name: term_glyph
version: 1.0.0
description: Useful glyphs and Windows-safe equivalents.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/term_glyph

environment:
  sdk: '>=1.8.0 <2.0.0'

dev_dependencies:
  csv: '^3.0.0'
  dart_style: '^0.2.0'
  test: '^0.12.0'

Version history

VersionPublishedArchiveSHA-256
1.0.02017-01-06T01:48:24.071ZDownload58d9dfe40ad80d419b7a69542b3eefc9eae64cd95fc7dccaa84beb06cd8a1f79
1.0.12018-07-17T17:18:51.851569ZDownload4526f8a4ced91369c4aa1b166532b285ad0d41376c07a665754193a0b6a05bde
1.1.02019-01-10T01:28:02.303526ZDownload20bd11d476c7267071bf13c3a6aff1627f7bb9149985122637e284864cc9d155
1.2.0-nullsafety2020-07-29T16:23:51.220281ZDownload7086f21e1ab03af1e05a2952b78d6ac91f521e4b7452576ab30ee4a7f1d3d942
1.2.0-nullsafety.12020-09-22T16:56:45.009904ZDownload7fde27202991e8d3dd92e73547d0a26c46bb3cf6aa21a21018c8b6d5c006686b
1.2.0-nullsafety.22020-10-23T21:33:38.244228ZDownload21d9c931a06db8b63df15e6435778733b13897cd7c77cf855483a87524e83b98
1.2.0-nullsafety.32020-11-03T22:36:54.776382ZDownload24fdfbe81eb0d4f3699d6f377c9142db390baee5c2a8cd2bf919f1b452d7030d
1.2.02021-02-02T23:21:11.938521ZDownloada88162591b02c1f3a3db3af8ce1ea2b374bd75a7bb8d5e353bcfbdc79d719830
1.2.12022-06-15T20:49:59.502761ZDownloada29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
1.2.22024-12-17T09:33:15.487660ZDownload7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e

Dependencies

No direct dependencies declared.