Skip to content

Commit

Permalink
introduce a local variable to avoid null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
miDeb committed Mar 6, 2021
1 parent a5aa4ba commit 9bbdea8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/src/badge_positioned.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class BadgePositioned extends StatelessWidget {

@override
Widget build(BuildContext context) {
final position = this.position;
if (position == null) {
final topRight = BadgePosition.topEnd();
return PositionedDirectional(
Expand All @@ -31,10 +32,10 @@ class BadgePositioned extends StatelessWidget {
);
}
return PositionedDirectional(
top: position!.top,
end: position!.end,
bottom: position!.bottom,
start: position!.start,
top: position.top,
end: position.end,
bottom: position.bottom,
start: position.start,
child: child,
);
}
Expand Down

0 comments on commit 9bbdea8

Please sign in to comment.