positive_num 1.0.1 positive_num: ^1.0.1 copied to clipboard
A value object that incapsulates a positive number that is greater than 0.
A value object that incapsulates a positive number that is greater than 0. It respects both int and double values.
Getting started #
How to start using the package #
dart pub add positive_num
Or specify the package's git url in pubspec.yaml at the dependencies section like that
dependencies:
positive_num:
git:
url: https://github.com/maxeema/positive_num.git
Then import it in your code.
import 'package:positive_num/positive_num.dart';
Usage #
import 'package:positive_num/positive_num.dart';
void main() {
var number = 1;
final result = PositiveNum.create(number);
if (result.instance != null) {
final positiveNum = result.instance!;
print('Created a PositiveNum instance with ${positiveNum.value} value.');
} else {
final error = result.error;
print('$error');
}
}
Before run #
dart pub get
Run example #
dart run example/positive_num_example.dart
Run tests #
dart test
Copyright #
© Max Shemetov, 2023, MIT License