diff --git a/packages/wyatt_type_utils/README.md b/packages/wyatt_type_utils/README.md index 75750496..98034973 100644 --- a/packages/wyatt_type_utils/README.md +++ b/packages/wyatt_type_utils/README.md @@ -1,5 +1,5 @@ - - # Dart - Wyatt Type Utils

- - Style: Wyatt Analysis - + Style: Wyatt Analysis SDK: Dart & Flutter

-Type Utils for Dart & Flutter. +Either, Option and other useful types and extensions for Dart (and Flutter). ## Option\ @@ -62,8 +58,8 @@ print('`rand` contains 10 ? => ${rand.contains(10)}'); *E.g. null reference exception or index out of bounds are not related to domain - they rather indicate a defect.* Either is defined as a generic type with two branches -- success with **T** -- failure with **E** +* success with **T** +* failure with **E** It can appear in two forms, where it contains an object of **Ok**, or where it contains an object of **Err**. It cannot appear in both states at once, or in none of them. Therefore, if one possesses an **Result** instance, it either contains a successfully produced result, or contains an error object. @@ -95,20 +91,20 @@ print(myList); // prints '[42, 16]' This package also provides extensions for Dart types. -- Object - - isNull - - isNotNull - - log -- Iterable - - isNullOrEmpty - - isNotNullOrEmpty - - For bytes iterables +* Object + + isNull + + isNotNull + + log +* Iterable + + isNullOrEmpty + + isNotNullOrEmpty + + For bytes iterables - toTypedList - toStr -- String - - isNullOrEmpty - - isNotNullOrEmpty - - toBytes +* String + + isNullOrEmpty + + isNotNullOrEmpty + + toBytes String 🔁 Uint8List works with encoding: @@ -118,27 +114,27 @@ final Uint8List bytes = myString.toBytes(from : Encoding.utf16); print(bytes.toStr(to : Encoding.utf16)); // prints 'abc' ``` -- DateTime - - fromSecondsSinceEpoch - - secondsSinceEpoch - - timestamp - - tomorrow - - yesterday - - today - - add/sub/set - - nextDay - - previousDay - - nextMonth - - previousMonth - - nextYear - - previousYear - - nextWeek - - previousWeek - - isFuture - - isPast - - isLeapYear - - format - - operators +* DateTime + + fromSecondsSinceEpoch + + secondsSinceEpoch + + timestamp + + tomorrow + + yesterday + + today + + add/sub/set + + nextDay + + previousDay + + nextMonth + + previousMonth + + nextYear + + previousYear + + nextWeek + + previousWeek + + isFuture + + isPast + + isLeapYear + + format + + operators The date formatter works with `String` formatter: diff --git a/packages/wyatt_type_utils/lib/src/either/option.dart b/packages/wyatt_type_utils/lib/src/either/option.dart index d97ed2ac..3502984f 100644 --- a/packages/wyatt_type_utils/lib/src/either/option.dart +++ b/packages/wyatt_type_utils/lib/src/either/option.dart @@ -171,8 +171,11 @@ abstract class Option extends _EitherBase { } } +/// {@template value} +/// Contains the non-null value of the [Option]. +/// {@endtemplate} class Value extends Option with _Left { - /// {@macro ok} + /// {@macro value} const Value(this.value) : super._(); final T value; @@ -236,8 +239,11 @@ class Value extends Option with _Left { _EitherBase _or(_EitherBase res) => this as _EitherBase; } +/// {@template none} +/// Contains no value. +/// {@endtemplate} class None extends Option with _Right { - /// {@macro ok} + /// {@macro none} const None() : super._(); @override diff --git a/packages/wyatt_type_utils/lib/src/extensions/encoding.dart b/packages/wyatt_type_utils/lib/src/extensions/encoding.dart index 4a6fb8f7..5289d5f0 100644 --- a/packages/wyatt_type_utils/lib/src/extensions/encoding.dart +++ b/packages/wyatt_type_utils/lib/src/extensions/encoding.dart @@ -14,6 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +/// Defines different text encoding types. enum Encoding { utf8, utf16, diff --git a/packages/wyatt_type_utils/pubspec.yaml b/packages/wyatt_type_utils/pubspec.yaml index c74145af..94d5faf7 100644 --- a/packages/wyatt_type_utils/pubspec.yaml +++ b/packages/wyatt_type_utils/pubspec.yaml @@ -1,16 +1,16 @@ name: wyatt_type_utils -description: Either, Option and other useful types. +description: Either, Option and other useful types and extensions. repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_type_utils version: 0.0.4 publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub environment: - sdk: '>=2.17.0 <3.0.0' + sdk: ">=2.17.0 <3.0.0" dev_dependencies: test: ^1.22.0 - + wyatt_analysis: hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub - version: ^2.4.1 \ No newline at end of file + version: ^2.4.1