Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AF-3801 fix reporter runtime error in Dart 2.1.0 #287

Merged
merged 3 commits into from
Jan 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions lib/src/reporter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,27 @@ final AnsiPen _red = new AnsiPen()..red();
final AnsiPen _yellow = new AnsiPen()..yellow();

class Reporter {
bool color = true;
bool quiet = false;
bool _color;
bool _quiet;

Reporter({bool this.color, bool this.quiet});
Reporter({color: true, quiet: false}) {
this.color = color;
this.quiet = quiet;
}

bool get color => _color;
bool get quiet => _quiet;

set color(bool b) => _color = b ?? true;
set quiet(bool b) => _quiet = b ?? false;

String colorBlue(String message) => _color(_blue, message);
String colorBlue(String message) => _colorMessage(_blue, message);

String colorGreen(String message) => _color(_green, message);
String colorGreen(String message) => _colorMessage(_green, message);

String colorRed(String message) => _color(_red, message);
String colorRed(String message) => _colorMessage(_red, message);

String colorYellow(String message) => _color(_yellow, message);
String colorYellow(String message) => _colorMessage(_yellow, message);

void log(String message, {bool shout: false}) {
_log(stdout, message, shout: shout);
Expand Down Expand Up @@ -89,7 +98,7 @@ class Reporter {
_log(stderr, colorYellow(message), shout: shout);
}

String _color(AnsiPen pen, String message) =>
String _colorMessage(AnsiPen pen, String message) =>
color && message.isNotEmpty ? pen(message) : message;

void _log(IOSink sink, String message, {bool shout: false}) {
Expand Down