h_utils

Last updated:

0 purchases

h_utils Image
h_utils Images
Add to Cart

Description:

h utils

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
Supplier
Consumer
Predicate
Runnable
Switcher
Optional
Either


Immutability



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);
copied to clipboard
Usage
final Method<int, String> method = (int input) => int.toString();
copied to clipboard
Value
final Method<dynamic, int> method = value(2);
method(4); // returns 2
copied to clipboard
Map
final Method<int, int> method = (int input) => int * 2;
method.map((number) => number / 2)(4); // returns 4
copied to clipboard
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
copied to clipboard
Format
final Method<String, String> method = (String input) => "Hello $input";
method.format("{}, how are you?")("World"); // returns Hello World, how are you?
copied to clipboard
ForEach
final Method<String, String> method = (String input) => "Hello $input";
method.format("{}, how are you?")("World"); // Hello World, how are you?
copied to clipboard
Supplier
Consumer
Predicate
Runnable
Switcher
Optional
Either
Immutability #

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.