A bunch of general cleanup (#23)
Set the SDK constraint to stable
Bump dependencies to stable versions
drop unneeded deps
Move last bit of code to null safety
Update CI
Enable and fix standard lints
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index 21a3c50..e47bf66 100644
--- a/.github/workflows/test-package.yml
+++ b/.github/workflows/test-package.yml
@@ -23,7 +23,7 @@
sdk: [dev]
steps:
- uses: actions/checkout@v2
- - uses: dart-lang/setup-dart@v0.3
+ - uses: dart-lang/setup-dart@v1.0
with:
sdk: ${{ matrix.sdk }}
- id: install
@@ -47,10 +47,10 @@
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
- sdk: [dev]
+ sdk: [2.12.0, dev]
steps:
- uses: actions/checkout@v2
- - uses: dart-lang/setup-dart@v0.3
+ - uses: dart-lang/setup-dart@v1.0
with:
sdk: ${{ matrix.sdk }}
- id: install
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15cbaf5..f2cd28f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,5 @@
+## 1.2.1-dev
+
## 1.2.0
* Stable release for null safety.
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 108d105..acbc3d0 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1 +1,78 @@
include: package:pedantic/analysis_options.yaml
+
+analyzer:
+ strong-mode:
+ implicit-casts: false
+
+linter:
+ rules:
+ - avoid_bool_literals_in_conditional_expressions
+ - avoid_catching_errors
+ - avoid_classes_with_only_static_members
+ - avoid_function_literals_in_foreach_calls
+ - avoid_private_typedef_functions
+ - avoid_redundant_argument_values
+ - avoid_renaming_method_parameters
+ - avoid_returning_null
+ - avoid_returning_null_for_future
+ - avoid_returning_null_for_void
+ - avoid_returning_this
+ - avoid_single_cascade_in_expression_statements
+ - avoid_unused_constructor_parameters
+ - avoid_void_async
+ - await_only_futures
+ - camel_case_types
+ - cancel_subscriptions
+ #- cascade_invocations
+ - comment_references
+ - constant_identifier_names
+ - control_flow_in_finally
+ - directives_ordering
+ - empty_statements
+ - file_names
+ - hash_and_equals
+ - implementation_imports
+ - invariant_booleans
+ - iterable_contains_unrelated_type
+ - join_return_with_assignment
+ #- lines_longer_than_80_chars
+ - list_remove_unrelated_type
+ - literal_only_boolean_expressions
+ - missing_whitespace_between_adjacent_strings
+ - no_adjacent_strings_in_list
+ - no_runtimeType_toString
+ - non_constant_identifier_names
+ - only_throw_errors
+ - overridden_fields
+ - package_api_docs
+ - package_names
+ - package_prefixed_library_names
+ - prefer_asserts_in_initializer_lists
+ - prefer_const_constructors
+ - prefer_const_declarations
+ - prefer_expression_function_bodies
+ - prefer_final_locals
+ - prefer_function_declarations_over_variables
+ - prefer_initializing_formals
+ - prefer_inlined_adds
+ - prefer_interpolation_to_compose_strings
+ - prefer_is_not_operator
+ - prefer_null_aware_operators
+ - prefer_relative_imports
+ - prefer_typing_uninitialized_variables
+ - prefer_void_to_null
+ - provide_deprecation_message
+ - sort_pub_dependencies
+ - test_types_in_equals
+ - throw_in_finally
+ - unnecessary_await_in_return
+ - unnecessary_brace_in_string_interps
+ - unnecessary_getters_setters
+ - unnecessary_lambdas
+ - unnecessary_null_aware_assignments
+ - unnecessary_overrides
+ - unnecessary_parenthesis
+ - unnecessary_statements
+ - unnecessary_string_interpolations
+ - use_string_buffers
+ - void_checks
diff --git a/lib/src/generated/ascii_glyph_set.dart b/lib/src/generated/ascii_glyph_set.dart
index e0c3a49..7c97d7f 100644
--- a/lib/src/generated/ascii_glyph_set.dart
+++ b/lib/src/generated/ascii_glyph_set.dart
@@ -10,7 +10,7 @@
class AsciiGlyphSet implements GlyphSet {
const AsciiGlyphSet();
- /// Returns [glyph] if [this] supports Unicode glyphs and [alternative]
+ /// Returns [glyph] if `this` supports Unicode glyphs and [alternative]
/// otherwise.
@override
String glyphOrAscii(String glyph, String alternative) => alternative;
diff --git a/lib/src/generated/glyph_set.dart b/lib/src/generated/glyph_set.dart
index 941da4f..10713b2 100644
--- a/lib/src/generated/glyph_set.dart
+++ b/lib/src/generated/glyph_set.dart
@@ -7,7 +7,7 @@
/// A class that provides access to every configurable glyph.
///
/// This is provided as a class so that individual chunks of code can choose
-/// between [ascii] and [unicode] glyphs. For example:
+/// between `ascii` and `unicode` glyphs. For example:
///
/// ```dart
/// import 'package:term_glyph/term_glyph.dart' as glyph;
@@ -28,7 +28,7 @@
/// }
/// ```
abstract class GlyphSet {
- /// Returns [glyph] if [this] supports Unicode glyphs and [alternative]
+ /// Returns [glyph] if `this` supports Unicode glyphs and [alternative]
/// otherwise.
String glyphOrAscii(String glyph, String alternative);
diff --git a/lib/src/generated/top_level.dart b/lib/src/generated/top_level.dart
index 9475953..c430b33 100644
--- a/lib/src/generated/top_level.dart
+++ b/lib/src/generated/top_level.dart
@@ -8,7 +8,7 @@
/// A bullet point.
///
-/// If [ascii] is `false`, this is "•". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "•". If it's `true`, this is
/// "*" instead.
String get bullet => glyph.glyphs.bullet;
@@ -17,7 +17,7 @@
/// Note that the Unicode arrow glyphs may overlap with adjacent characters in some
/// terminal fonts, and should generally be surrounding by spaces.
///
-/// If [ascii] is `false`, this is "←". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "←". If it's `true`, this is
/// "<" instead.
String get leftArrow => glyph.glyphs.leftArrow;
@@ -26,355 +26,355 @@
/// Note that the Unicode arrow glyphs may overlap with adjacent characters in some
/// terminal fonts, and should generally be surrounding by spaces.
///
-/// If [ascii] is `false`, this is "→". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "→". If it's `true`, this is
/// ">" instead.
String get rightArrow => glyph.glyphs.rightArrow;
/// An upwards-pointing arrow.
///
-/// If [ascii] is `false`, this is "↑". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "↑". If it's `true`, this is
/// "^" instead.
String get upArrow => glyph.glyphs.upArrow;
/// A downwards-pointing arrow.
///
-/// If [ascii] is `false`, this is "↓". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "↓". If it's `true`, this is
/// "v" instead.
String get downArrow => glyph.glyphs.downArrow;
/// A two-character left-pointing arrow.
///
-/// If [ascii] is `false`, this is "◀━". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "◀━". If it's `true`, this is
/// "<=" instead.
String get longLeftArrow => glyph.glyphs.longLeftArrow;
/// A two-character right-pointing arrow.
///
-/// If [ascii] is `false`, this is "━▶". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "━▶". If it's `true`, this is
/// "=>" instead.
String get longRightArrow => glyph.glyphs.longRightArrow;
/// A horizontal line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "─". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "─". If it's `true`, this is
/// "-" instead.
String get horizontalLine => glyph.glyphs.horizontalLine;
/// A vertical line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "│". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "│". If it's `true`, this is
/// "|" instead.
String get verticalLine => glyph.glyphs.verticalLine;
/// The upper left-hand corner of a box.
///
-/// If [ascii] is `false`, this is "┌". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┌". If it's `true`, this is
/// "," instead.
String get topLeftCorner => glyph.glyphs.topLeftCorner;
/// The upper right-hand corner of a box.
///
-/// If [ascii] is `false`, this is "┐". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┐". If it's `true`, this is
/// "," instead.
String get topRightCorner => glyph.glyphs.topRightCorner;
/// The lower left-hand corner of a box.
///
-/// If [ascii] is `false`, this is "└". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "└". If it's `true`, this is
/// "'" instead.
String get bottomLeftCorner => glyph.glyphs.bottomLeftCorner;
/// The lower right-hand corner of a box.
///
-/// If [ascii] is `false`, this is "┘". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┘". If it's `true`, this is
/// "'" instead.
String get bottomRightCorner => glyph.glyphs.bottomRightCorner;
/// An intersection of vertical and horizontal box lines.
///
-/// If [ascii] is `false`, this is "┼". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┼". If it's `true`, this is
/// "+" instead.
String get cross => glyph.glyphs.cross;
/// A horizontal box line with a vertical line going up from the middle.
///
-/// If [ascii] is `false`, this is "┴". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┴". If it's `true`, this is
/// "+" instead.
String get teeUp => glyph.glyphs.teeUp;
/// A horizontal box line with a vertical line going down from the middle.
///
-/// If [ascii] is `false`, this is "┬". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┬". If it's `true`, this is
/// "+" instead.
String get teeDown => glyph.glyphs.teeDown;
/// A vertical box line with a horizontal line going left from the middle.
///
-/// If [ascii] is `false`, this is "┤". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┤". If it's `true`, this is
/// "+" instead.
String get teeLeft => glyph.glyphs.teeLeft;
/// A vertical box line with a horizontal line going right from the middle.
///
-/// If [ascii] is `false`, this is "├". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "├". If it's `true`, this is
/// "+" instead.
String get teeRight => glyph.glyphs.teeRight;
/// The top half of a vertical box line.
///
-/// If [ascii] is `false`, this is "╵". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╵". If it's `true`, this is
/// "'" instead.
String get upEnd => glyph.glyphs.upEnd;
/// The bottom half of a vertical box line.
///
-/// If [ascii] is `false`, this is "╷". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╷". If it's `true`, this is
/// "," instead.
String get downEnd => glyph.glyphs.downEnd;
/// The left half of a horizontal box line.
///
-/// If [ascii] is `false`, this is "╴". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╴". If it's `true`, this is
/// "-" instead.
String get leftEnd => glyph.glyphs.leftEnd;
/// The right half of a horizontal box line.
///
-/// If [ascii] is `false`, this is "╶". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╶". If it's `true`, this is
/// "-" instead.
String get rightEnd => glyph.glyphs.rightEnd;
/// A bold horizontal line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "━". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "━". If it's `true`, this is
/// "=" instead.
String get horizontalLineBold => glyph.glyphs.horizontalLineBold;
/// A bold vertical line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "┃". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┃". If it's `true`, this is
/// "|" instead.
String get verticalLineBold => glyph.glyphs.verticalLineBold;
/// The bold upper left-hand corner of a box.
///
-/// If [ascii] is `false`, this is "┏". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┏". If it's `true`, this is
/// "," instead.
String get topLeftCornerBold => glyph.glyphs.topLeftCornerBold;
/// The bold upper right-hand corner of a box.
///
-/// If [ascii] is `false`, this is "┓". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┓". If it's `true`, this is
/// "," instead.
String get topRightCornerBold => glyph.glyphs.topRightCornerBold;
/// The bold lower left-hand corner of a box.
///
-/// If [ascii] is `false`, this is "┗". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┗". If it's `true`, this is
/// "'" instead.
String get bottomLeftCornerBold => glyph.glyphs.bottomLeftCornerBold;
/// The bold lower right-hand corner of a box.
///
-/// If [ascii] is `false`, this is "┛". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┛". If it's `true`, this is
/// "'" instead.
String get bottomRightCornerBold => glyph.glyphs.bottomRightCornerBold;
/// An intersection of bold vertical and horizontal box lines.
///
-/// If [ascii] is `false`, this is "╋". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╋". If it's `true`, this is
/// "+" instead.
String get crossBold => glyph.glyphs.crossBold;
/// A bold horizontal box line with a vertical line going up from the middle.
///
-/// If [ascii] is `false`, this is "┻". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┻". If it's `true`, this is
/// "+" instead.
String get teeUpBold => glyph.glyphs.teeUpBold;
/// A bold horizontal box line with a vertical line going down from the middle.
///
-/// If [ascii] is `false`, this is "┳". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┳". If it's `true`, this is
/// "+" instead.
String get teeDownBold => glyph.glyphs.teeDownBold;
/// A bold vertical box line with a horizontal line going left from the middle.
///
-/// If [ascii] is `false`, this is "┫". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┫". If it's `true`, this is
/// "+" instead.
String get teeLeftBold => glyph.glyphs.teeLeftBold;
/// A bold vertical box line with a horizontal line going right from the middle.
///
-/// If [ascii] is `false`, this is "┣". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┣". If it's `true`, this is
/// "+" instead.
String get teeRightBold => glyph.glyphs.teeRightBold;
/// The top half of a bold vertical box line.
///
-/// If [ascii] is `false`, this is "╹". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╹". If it's `true`, this is
/// "'" instead.
String get upEndBold => glyph.glyphs.upEndBold;
/// The bottom half of a bold vertical box line.
///
-/// If [ascii] is `false`, this is "╻". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╻". If it's `true`, this is
/// "," instead.
String get downEndBold => glyph.glyphs.downEndBold;
/// The left half of a bold horizontal box line.
///
-/// If [ascii] is `false`, this is "╸". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╸". If it's `true`, this is
/// "-" instead.
String get leftEndBold => glyph.glyphs.leftEndBold;
/// The right half of a bold horizontal box line.
///
-/// If [ascii] is `false`, this is "╺". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╺". If it's `true`, this is
/// "-" instead.
String get rightEndBold => glyph.glyphs.rightEndBold;
/// A double horizontal line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "═". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "═". If it's `true`, this is
/// "=" instead.
String get horizontalLineDouble => glyph.glyphs.horizontalLineDouble;
/// A double vertical line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "║". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "║". If it's `true`, this is
/// "|" instead.
String get verticalLineDouble => glyph.glyphs.verticalLineDouble;
/// The double upper left-hand corner of a box.
///
-/// If [ascii] is `false`, this is "╔". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╔". If it's `true`, this is
/// "," instead.
String get topLeftCornerDouble => glyph.glyphs.topLeftCornerDouble;
/// The double upper right-hand corner of a box.
///
-/// If [ascii] is `false`, this is "╗". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╗". If it's `true`, this is
/// "," instead.
String get topRightCornerDouble => glyph.glyphs.topRightCornerDouble;
/// The double lower left-hand corner of a box.
///
-/// If [ascii] is `false`, this is "╚". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╚". If it's `true`, this is
/// """ instead.
String get bottomLeftCornerDouble => glyph.glyphs.bottomLeftCornerDouble;
/// The double lower right-hand corner of a box.
///
-/// If [ascii] is `false`, this is "╝". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╝". If it's `true`, this is
/// """ instead.
String get bottomRightCornerDouble => glyph.glyphs.bottomRightCornerDouble;
/// An intersection of double vertical and horizontal box lines.
///
-/// If [ascii] is `false`, this is "╬". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╬". If it's `true`, this is
/// "+" instead.
String get crossDouble => glyph.glyphs.crossDouble;
/// A double horizontal box line with a vertical line going up from the middle.
///
-/// If [ascii] is `false`, this is "╩". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╩". If it's `true`, this is
/// "+" instead.
String get teeUpDouble => glyph.glyphs.teeUpDouble;
/// A double horizontal box line with a vertical line going down from the middle.
///
-/// If [ascii] is `false`, this is "╦". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╦". If it's `true`, this is
/// "+" instead.
String get teeDownDouble => glyph.glyphs.teeDownDouble;
/// A double vertical box line with a horizontal line going left from the middle.
///
-/// If [ascii] is `false`, this is "╣". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╣". If it's `true`, this is
/// "+" instead.
String get teeLeftDouble => glyph.glyphs.teeLeftDouble;
/// A double vertical box line with a horizontal line going right from the middle.
///
-/// If [ascii] is `false`, this is "╠". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╠". If it's `true`, this is
/// "+" instead.
String get teeRightDouble => glyph.glyphs.teeRightDouble;
/// A dashed horizontal line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "╌". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╌". If it's `true`, this is
/// "-" instead.
String get horizontalLineDoubleDash => glyph.glyphs.horizontalLineDoubleDash;
/// A bold dashed horizontal line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "╍". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╍". If it's `true`, this is
/// "-" instead.
String get horizontalLineDoubleDashBold =>
glyph.glyphs.horizontalLineDoubleDashBold;
/// A dashed vertical line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "╎". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╎". If it's `true`, this is
/// "|" instead.
String get verticalLineDoubleDash => glyph.glyphs.verticalLineDoubleDash;
/// A bold dashed vertical line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "╏". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "╏". If it's `true`, this is
/// "|" instead.
String get verticalLineDoubleDashBold =>
glyph.glyphs.verticalLineDoubleDashBold;
/// A dashed horizontal line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "┄". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┄". If it's `true`, this is
/// "-" instead.
String get horizontalLineTripleDash => glyph.glyphs.horizontalLineTripleDash;
/// A bold dashed horizontal line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "┅". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┅". If it's `true`, this is
/// "-" instead.
String get horizontalLineTripleDashBold =>
glyph.glyphs.horizontalLineTripleDashBold;
/// A dashed vertical line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "┆". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┆". If it's `true`, this is
/// "|" instead.
String get verticalLineTripleDash => glyph.glyphs.verticalLineTripleDash;
/// A bold dashed vertical line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "┇". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┇". If it's `true`, this is
/// "|" instead.
String get verticalLineTripleDashBold =>
glyph.glyphs.verticalLineTripleDashBold;
/// A dashed horizontal line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "┈". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┈". If it's `true`, this is
/// "-" instead.
String get horizontalLineQuadrupleDash =>
glyph.glyphs.horizontalLineQuadrupleDash;
/// A bold dashed horizontal line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "┉". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┉". If it's `true`, this is
/// "-" instead.
String get horizontalLineQuadrupleDashBold =>
glyph.glyphs.horizontalLineQuadrupleDashBold;
/// A dashed vertical line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "┊". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┊". If it's `true`, this is
/// "|" instead.
String get verticalLineQuadrupleDash => glyph.glyphs.verticalLineQuadrupleDash;
/// A bold dashed vertical line that can be used to draw a box.
///
-/// If [ascii] is `false`, this is "┋". If it's `true`, this is
+/// If [glyph.ascii] is `false`, this is "┋". If it's `true`, this is
/// "|" instead.
String get verticalLineQuadrupleDashBold =>
glyph.glyphs.verticalLineQuadrupleDashBold;
diff --git a/lib/src/generated/unicode_glyph_set.dart b/lib/src/generated/unicode_glyph_set.dart
index 1737b39..1ddd165 100644
--- a/lib/src/generated/unicode_glyph_set.dart
+++ b/lib/src/generated/unicode_glyph_set.dart
@@ -10,7 +10,7 @@
class UnicodeGlyphSet implements GlyphSet {
const UnicodeGlyphSet();
- /// Returns [glyph] if [this] supports Unicode glyphs and [alternative]
+ /// Returns [glyph] if `this` supports Unicode glyphs and [alternative]
/// otherwise.
@override
String glyphOrAscii(String glyph, String alternative) => glyph;
diff --git a/lib/term_glyph.dart b/lib/term_glyph.dart
index b7361be..9f2b422 100644
--- a/lib/term_glyph.dart
+++ b/lib/term_glyph.dart
@@ -2,13 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-export 'src/generated/glyph_set.dart';
-export 'src/generated/top_level.dart';
-
import 'src/generated/ascii_glyph_set.dart';
import 'src/generated/glyph_set.dart';
import 'src/generated/unicode_glyph_set.dart';
+export 'src/generated/glyph_set.dart';
+export 'src/generated/top_level.dart';
+
/// A [GlyphSet] that always returns ASCII glyphs.
const GlyphSet asciiGlyphs = AsciiGlyphSet();
diff --git a/pubspec.yaml b/pubspec.yaml
index 18177a3..428f766 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,14 +1,13 @@
name: term_glyph
-version: 1.2.0
+version: 1.2.1-dev
description: Useful Unicode glyphs and ASCII substitutes.
homepage: https://github.com/dart-lang/term_glyph
environment:
- sdk: ">=2.12.0-0 <3.0.0"
+ sdk: ">=2.12.0 <3.0.0"
dev_dependencies:
- csv: '>=3.0.0 <5.0.0'
- dart_style: '>=0.2.0 <2.0.0'
- meta: ^1.3.0-nullsafety
- test: ^1.16.0-nullsafety
+ csv: ^5.0.0
+ dart_style: ^2.0.0
+ test: ^1.16.0
diff --git a/tool/generate.dart b/tool/generate.dart
index 90fc2e8..007913b 100644
--- a/tool/generate.dart
+++ b/tool/generate.dart
@@ -1,18 +1,14 @@
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-//
-// TODO: Remove once package:csv/csv.dart is migrated.
-// @dart=2.9
import 'dart:io';
import 'package:csv/csv.dart';
-import 'package:meta/meta.dart';
void main() {
- var csv = CsvCodec(eol: '\n');
- var data = csv.decoder.convert(File('data.csv').readAsStringSync());
+ final csv = CsvCodec(eol: '\n');
+ final data = csv.decoder.convert(File('data.csv').readAsStringSync());
// Remove comments and empty lines.
data.removeWhere((row) => row.length < 3);
@@ -24,7 +20,7 @@
_writeGlyphSet(data, ascii: true);
_writeTopLevel(data);
- var result = Process.runSync(
+ final result = Process.runSync(
'pub', ['run', 'dart_style:format', '-w', 'lib/src/generated']);
print(result.stderr);
exit(result.exitCode);
@@ -32,7 +28,7 @@
/// Writes `lib/src/generated/glyph_set.dart`.
void _writeGlyphSetInterface(List<List> data) {
- var file =
+ final file =
File('lib/src/generated/glyph_set.dart').openSync(mode: FileMode.write);
file.writeStringSync(r'''
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
@@ -44,7 +40,7 @@
/// A class that provides access to every configurable glyph.
///
/// This is provided as a class so that individual chunks of code can choose
- /// between [ascii] and [unicode] glyphs. For example:
+ /// between `ascii` and `unicode` glyphs. For example:
///
/// ```dart
/// import 'package:term_glyph/term_glyph.dart' as glyph;
@@ -65,13 +61,13 @@
/// }
/// ```
abstract class GlyphSet {
- /// Returns [glyph] if [this] supports Unicode glyphs and [alternative]
+ /// Returns [glyph] if `this` supports Unicode glyphs and [alternative]
/// otherwise.
String glyphOrAscii(String glyph, String alternative);
''');
for (var glyph in data) {
- for (var line in glyph[3].split('\n')) {
+ for (var line in (glyph[3] as String).split('\n')) {
file.writeStringSync('/// $line\n');
}
@@ -86,12 +82,12 @@
///
/// If [ascii] is `true`, this writes the ASCII glyph set. Otherwise it writes
/// the Unicode glyph set.
-void _writeGlyphSet(List<List> data, {@required bool ascii}) {
- var file =
+void _writeGlyphSet(List<List> data, {required bool ascii}) {
+ final file =
File('lib/src/generated/${ascii ? "ascii" : "unicode"}_glyph_set.dart')
.openSync(mode: FileMode.write);
- var className = '${ascii ? "Ascii" : "Unicode"}GlyphSet';
+ final className = '${ascii ? "Ascii" : "Unicode"}GlyphSet';
file.writeStringSync('''
// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
@@ -104,18 +100,18 @@
/// A [GlyphSet] that includes only ${ascii ? "ASCII" : "Unicode"} glyphs.
class $className implements GlyphSet {
const $className();
- /// Returns [glyph] if [this] supports Unicode glyphs and [alternative]
+ /// Returns [glyph] if `this` supports Unicode glyphs and [alternative]
/// otherwise.
@override
String glyphOrAscii(String glyph, String alternative) =>
${ascii ? "alternative" : "glyph"};
''');
- var index = ascii ? 2 : 1;
+ final index = ascii ? 2 : 1;
for (var glyph in data) {
file.writeStringSync('''
@override
- String get ${glyph[0]} => ${_quote(glyph[index])};
+ String get ${glyph[0]} => ${_quote(glyph[index] as String)};
''');
}
@@ -125,7 +121,7 @@
/// Writes `lib/src/generated/top_level.dart`.
void _writeTopLevel(List<List> data) {
- var file =
+ final file =
File('lib/src/generated/top_level.dart').openSync(mode: FileMode.write);
file.writeStringSync('''
@@ -139,13 +135,13 @@
''');
for (var glyph in data) {
- for (var line in glyph[3].split('\n')) {
+ for (var line in (glyph[3] as String).split('\n')) {
file.writeStringSync('/// $line\n');
}
file.writeStringSync('''
///
- /// If [ascii] is `false`, this is "${glyph[1]}". If it's `true`, this is
+ /// If [glyph.ascii] is `false`, this is "${glyph[1]}". If it's `true`, this is
/// "${glyph[2]}" instead.
String get ${glyph[0]} => glyph.glyphs.${glyph[0]};
''');