H(elpful)Utils
This is a work in progress
About
This is a set of helper classes I feel that Dart was missing.
Disclaimer this is made for personal use and interface changes might occur.
Features
Usage
Date & Time
Control Flow
Method
A function that takes an input of type I
and returns a value of O
.
typedef Method<I, O> = O Function(I);
Usage
final Method<int, String> method = (int input) => int.toString();
Value
final Method<dynamic, int> method = value(2);
method(4); // returns 2
Map
final Method<int, int> method = (int input) => int * 2;
method.map((number) => number / 2)(4); // returns 4
Also
final Method<String, String> method = (String input) => "Hello $input";
final Method<String, String> printedMethod = method.also((String input) => print(input));
also("World"); // prints World, returns Hello World
Format
final Method<String, String> method = (String input) => "Hello $input";
method.format("{}, how are you?")("World"); // returns Hello World, how are you?
ForEach
final Method<String, String> method = (String input) => "Hello $input";
method.format("{}, how are you?")("World"); // Hello World, how are you?
Supplier
Consumer
Predicate
Runnable
Switcher
Optional
Either
Immutability
Libraries
- control_flow/conditions
- control_flow/consumer
- control_flow/functional
- control_flow/if/if
- control_flow/math
- control_flow/method
- control_flow/optional/empty
- control_flow/optional/optional
- control_flow/optional/present
- control_flow/optional/tuple/both_present
- control_flow/optional/tuple/first_present
- control_flow/optional/tuple/neither_present
- control_flow/optional/tuple/optional_tuple
- control_flow/optional/tuple/second_present
- control_flow/optional/typed/non_blank_string
- control_flow/optional/typed/optional_list
- control_flow/optional/typed/optional_num
- control_flow/optional/typed/optional_string
- control_flow/predicate
- control_flow/runnable
- control_flow/supplier
- control_flow/switcher
- control_flow/try
- control_flow/using
- date_time/date
- date_time/time
- h_utils
- immutable/builder
- immutable/list
- immutable/map
- logger/logger
- string
- widgets/popup/blur_popup
- widgets/popup/popup