Skip to content

Commit c3e11c9

Browse files
committed
feat(extension): num extension
Signed-off-by: kapdroid <[email protected]>
1 parent 72329cc commit c3e11c9

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/fa_flutter_core.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ export 'src/utils/platform_utils.dart';
5555
export 'src/utils/image_utils.dart';
5656
export 'src/void_result/void_result.dart';
5757
export 'src/extension/string_extension.dart';
58+
export 'src/extension/num_extension.dart';
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
3+
extension NumExtension on num {
4+
/// Returns 0 if the number is negative, otherwise returns the original value
5+
num nonNegative() {
6+
return this < 0 ? 0 : this;
7+
}
8+
}

0 commit comments

Comments
 (0)