Skip to content

Commit a7ff718

Browse files
committed
3.0.0-dev.1
1 parent 334f3c1 commit a7ff718

24 files changed

+11733
-559
lines changed

CHANGELOG.md

+43
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,47 @@
11
# CHANGELOG
2+
## [3.0.0-dev.1]
3+
4+
#### Added
5+
6+
- Introduced **`Paginator`**, **`AsyncPaginator`**, and **`InfinitePaginator`** for synchronous, asynchronous, and
7+
infinite scrolling pagination support.
8+
9+
- **New `calculateAge()` method** in `DateTime` extensions to compute age from a date with a leap year check.
10+
11+
- **Numerals:**
12+
13+
- `safeDivide`: Safely divides two numbers with custom handling for division by zero and zero values.
14+
- `roundToNearestMultiple`, `roundUpToMultiple`, `roundDownToMultiple`: Rounds numbers to the nearest, up, or down
15+
to specified multiples.
16+
- `isBetween`: Checks if a number is within a specified range with optional inclusivity.
17+
- `toCurrency`, `toPercent`, `toFractionString`: Converts numbers to currency, percentage, or fraction string
18+
formats.
19+
- `isApproximatelyEqual`, `isCloseTo`: Compares numbers within specified tolerance or delta.
20+
- `scaleBetween`: Normalizes a number between specified minimum and maximum values.
21+
- `isInteger`: Checks if a number is an integer.
22+
- `factorial`, `gcd`, `lcm`: Calculates factorial, greatest common divisor, and least common multiple.
23+
- `isPrime`, `primeFactors`: Checks for primality and calculates prime factors.
24+
- `toRomanNumeral`, `toOrdinal`: Converts integers to Roman numerals or ordinal representation.
25+
- `isPerfectSquare`, `isPerfectCube`, `isFibonacci`: Checks if an integer is a perfect square, cube, or Fibonacci
26+
number.
27+
- `isPowerOf`: Checks if an integer is a power of another number.
28+
- `toBinaryString`, `toHexString`, `bitCount`: Converts integers to binary, hexadecimal, and counts set bits.
29+
- `isDivisibleBy`: Checks if an integer is divisible by another number.
30+
31+
- **New NumbersHelper class with static methods:**
32+
- Added utilities for safe division, mean, median, mode, variance, standard deviation, and percentiles.
33+
- Introduced methods for GCD, checking perfect squares, and converting Roman numerals to integers.
34+
35+
#### Changed
36+
37+
- **Improved `tryGetX` methods in `Iterable` and `Map` extensions:** Added alternative key lookups using `altKeys` in
38+
various getter methods like `getString()`, `getInt()`, etc.
39+
40+
#### Removed
41+
42+
- **`HttpResStatus` enum** and associated extensions were removed, replaced by new lightweight HTTP status
43+
code handling methods like `toHttpStatusMessage`.
44+
245
## [2.7.0]
346
- **Added the `toDecimalString` method on numbers**:
447
similar to `toStringAsFixed` which allows formatting numbers to a specified

example/dart_helper_utils_example.dart

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'package:dart_helper_utils/dart_helper_utils.dart';
22

33
Future<void> main() async {
4-
print(0 / 0);
54
// parsing dynamic numeric list to num, int, and double.
65
final list = <dynamic>[1, 2, '3', '3.1', 22.3];
76

@@ -43,11 +42,11 @@ Future<void> main() async {
4342
final userMail = toString1(userMap['email']);
4443
print('Is Valid Email: ${userMail.isValidEmail}');
4544

46-
// Example of using HttpResStatus
47-
final status = 200.toHttpResStatus;
48-
print('Status: ${status.code} - ${status.desc}');
49-
print('Is Success: ${status.isSuccess}');
50-
print('Is Client Error: ${status.isClientError}');
45+
// Example of using the global [httpStatusMessages]
46+
const httpStatusCode = 200;
47+
print('Status: $httpStatusCode - ${httpStatusMessages[httpStatusCode]}');
48+
print('Is Success: ${httpStatusCode.isSuccessCode}');
49+
print('Is Client Error: ${httpStatusCode.isClientErrorCode}');
5150

5251
// quickly use normal date parsing.
5352
print('1997-08-12 00:00:00.000'.toDateTime);
@@ -222,6 +221,19 @@ Future<void> main() async {
222221
print(12.10.toDecimalString(2)); // Output: 12.1
223222
print(12.1.toDecimalString(2, keepTrailingZeros: true)); // 12.10
224223
print(12.123.toDecimalString(2)); // 12.12
224+
225+
final age = DateTime(1997, 8, 12).calculateAge();
226+
print('I am ${age.years} old!');
227+
228+
print(DHUTimezone.generate());
229+
final palestine = DHUCountry.getByCode('ps');
230+
print(palestine?.flagEmoji); // 🇵🇸
231+
print(palestine?.nativeNames);
232+
print(palestine?.timezones);
233+
234+
final timeZone = DHUTimezone.byIdentifier('Africa/Cairo');
235+
print(timeZone!.abbreviation);
236+
timeZone.getCountries().forEach((e) => print(e.flagEmoji));
225237
}
226238

227239
// Example enum used in the map

lib/dart_helper_utils.dart

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
library dart_helper_utils;
2+
13
export 'src/src.dart';

lib/src/enums/enums.dart

-1
This file was deleted.

lib/src/enums/http_status_code.dart

-271
This file was deleted.

0 commit comments

Comments
 (0)