Skip to content

Commit 9ee56c3

Browse files
timmaffetthaarts
authored andcommitted
simplified logic to initialize includeBox map (and remove need for null safety ! operator)
1 parent e97b4bd commit 9ee56c3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/src/printers/pretty_printer.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class PrettyPrinter extends LogPrinter {
7979
/// for example to prevent boxing of [Level.verbose] and [Level.info] use excludeBox:{Level.verbose:true, Level.info:true}
8080
final Map<Level, bool> excludeBox;
8181

82-
/// To make the default for every level to prevent boxing entirely set [noBoxing] to true
82+
/// To make the default for every level to prevent boxing entirely set [noBoxingByDefault] to true
8383
/// (boxing can still be turned on for some levels by using something like excludeBox:{Level.error:false} )
8484
final bool noBoxingByDefault;
8585

@@ -115,11 +115,8 @@ class PrettyPrinter extends LogPrinter {
115115

116116
// Translate excludeBox map (constant if default) to includeBox map with all Level enum possibilities
117117
includeBox = {};
118-
for (var levelEnum in Level.values) {
119-
includeBox[levelEnum] = excludeBox.containsKey(levelEnum)
120-
? !excludeBox[levelEnum]!
121-
: !noBoxingByDefault;
122-
}
118+
Level.values.forEach((l) => includeBox[l] = !noBoxingByDefault);
119+
excludeBox.forEach((k, v) => includeBox[k] = !v);
123120
}
124121

125122
@override

0 commit comments

Comments
 (0)