Skip to content

Commit

Permalink
Refactor some null checks into case patterns to avoid !
Browse files Browse the repository at this point in the history
  • Loading branch information
natebosch committed Jan 17, 2025
1 parent 4f92041 commit 585a44e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkgs/args/lib/src/usage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ class _Usage {
_write(0, _abbreviation(option));
_write(1, '${_longOption(option)}${_mandatoryOption(option)}');

if (option.help != null) _write(2, option.help!);
if (option.help case final help?) _write(2, help);

if (option.allowedHelp != null) {
if (option.allowedHelp case final allowedHelp?) {
_newline();
for (var name in option.allowedHelp!.keys) {
for (var MapEntry(key: name, value: content) in allowedHelp.entries) {
_write(1, _allowedTitle(option, name));
_write(2, option.allowedHelp![name]!);
_write(2, content);
}
_newline();
} else if (option.allowed != null) {
Expand Down

0 comments on commit 585a44e

Please sign in to comment.