sugar library

Contains the sugar collection, core and time libraries.

Classes

Date
An immutable date without a timezone.
Day
Constants that represent a day in other time units.
Debounce
Represents a capped exponential back-off in milliseconds with jittering.
Hour
Constants that represent an hour in other time units.
LocalDateTime
An immutable date-time without a timezone.
Microsecond
Constants that represent a microsecond in other time units.
Millisecond
Constants that represent a millisecond in other time units.
Minute
Constants that represent a minute in other time units.
Pair<K, V>
Represents an immutable key-value pair.
Period<T extends Comparable<T>>
Represents a length between two points in time.
PlatformDependent
Denotes that an annotated type is platform dependent
Quad<T1, T2, T3, T4>
Represents an immutable tuple that contains 4 values.
Result<T, E>
A monad that represents the result of an operation which may contain a value if successful, or an error otherwise.
Second
Constants that represent a second in other time units.
Subset<T>
Denotes that an annotated function returns a union type. A union type represents a subset of possible values.
Throws
Denotes that an annotated method throws the given exceptions.
Time
An immutable time without a timezone.
Triple<L, M, R>
Represents an immutable tuple that contains 3 values.
Types
Provides utilities for comparing and manipulating types.
Union<L, R>
A monad that represents a union type.
UtcDateTime
An immutable date-time in the UTC±00:00 timezone.
Weekdays
Utilities to encode and decode the days in a week into an 8-bit bitfield. A bitfield represents one week with each bit representing a day. It is big-endian with the first bit in the bitfield always being unused.

Enums

TimeUnit
A temporal unit.

Mixins

Disposable
Signifies that the implementing type holds resource (i.e. sockets, streams) that need to be manually disposed.
Equality
A skeleton to simplify implementation of symmetrical equality.
MultiPart
Represents a DateTime which date and time can be individually extracted.
Relatable<T extends Relatable<T>>
A skeleton that implements comparison operators using compareTo.
RoundableDateTime<T extends RoundableDateTime<T>>
A DateTime that can be rounded.
Temporal<T extends Temporal<T>>
An immutable temporal.

Extensions

Calls on Call
Contains functions for composing Calls and other operations.
Chronological on DateTime
Provides operations to allow DateTimes to be chronologically compared using the comparison operators.
Consumers on Consumer<T>
Contains functions for composing Consumers.
DateTimePeriod on Period<DateTime>
Utilities for calculating the length of a period of DateTime.
DefaultRoundableDate on DateTime
The default implementation for RoundableDateTime.
DefaultTemporal on DateTime
The default implementation for Temporal.
HashExtensions on String
An extension that provides additional hashing methods.
Integers on int
Utilities for handling overflows.
Iterables on Iterable<T>
Provides additional operations for Iterable.
ListEquality on List<T>
Utilities for comparison of the contents of lists.
Lists on List<T>
Provides additional operations for lists.
MapEquality on Map<K, V>
Utilities for comparison of the contents of maps.
Mappers on Mapper<T, R>
Contains functions for composing Mappers and other operations.
NumericalPeriod on Period<num>
Utilities for calculating the length of the period of numbers.
PaddedNumber on T
Utilities for formatting numbers.
Predicates on Predicate<T>
Contains functions for composing Predicates and other operations.
RoundableNumber on T
Utilities for rounding a number.
SetEquality on Set<T>
Utilities for comparison of the contents of sets.
Strings on String
Utilities for manipulating Strings.
Suppliers on Supplier<T>
Contains functions for composing Suppliers and other operations.
TimePeriod on Period<Time>
Utilities for calculating the length of a period of time.
TupleIterable on Iterable<Iterable>
Provides functions to convert Iterables of lists into Iterables of tuples.

Constants

annotation → const String
Denotes that the annotated type is an annotation.
throws → const String
Denotes that the annotated method throws an exception.
untestable → const String
Denotes that the annotated type/method is untestable.

Functions

ceil<T extends num>(T value, num nearest) → T
Ceils value to the nearest nearest.
floor<T extends num>(T value, num nearest) → T
Floors value to the nearest nearest.
max<T extends Comparable<T>>(T a, T b) → T
Returns the larger of two Comparables.
min<T extends Comparable<T>>(T a, T b) → T
Returns the smaller of two Comparables.
nonce([int length = 32]) String
Generates a random nonce.
round<T extends num>(T value, num nearest) → T
Rounds value to the nearest nearest.

Typedefs

Call = void Function()
Represents an operation with no arguments.
Consumer<T> = void Function(T)
Represents an operation that accepts a single argument.
Mapper<T, R> = R Function(T)
Maps a value of type T to R.
Predicate<T> = bool Function(T)
Represents a predicate (boolean-valued function) of one argument.
Supplier<T> = T Function()
Represents a supplier of results.

Exceptions / Errors

ResultError
Signals that an error has occurred while manipulating a Result.