From ee23b90cbca367fcb13be4d29a9cb7e4c738c5ac Mon Sep 17 00:00:00 2001 From: Rabia Sarfaraz Date: Sun, 12 Apr 2026 14:56:43 +0500 Subject: [PATCH] docs: add documentation for Unit class --- lib/src/unit.dart | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/src/unit.dart b/lib/src/unit.dart index 2460d70..59d1972 100644 --- a/lib/src/unit.dart +++ b/lib/src/unit.dart @@ -1,4 +1,20 @@ -// ignore_for_file: unnecessary_new +/// Represents a Unit type (a type with only one value). +/// +/// In functional programming, Unit is used when a function +/// needs to return a value, but the actual value is not important. +/// +/// It is similar to `void`, but unlike `void`, it is a proper type +/// and can be used in expressions. +/// +/// Example: +/// ```dart +/// final u = unit; +/// print(u); // () +/// ``` +/// +/// This is useful in cases where you want to indicate that +/// a computation has completed but does not return meaningful data. +/// // ignore_for_file: unnecessary_new // ignore_for_file: unnecessary_const part of dartz;