sugar library Sugar
Bundles and exports all other libraries.
All libraries are bundled and exported for one-line importing:
import 'package:sugar/sugar.dart';
It is recommended to treat this library as an index and browse through the individual libraries. Trying to understand Sugar by browsing through the aggregated classes can be overwhelming.
Classes
- DefaultTimezoneProvider
- The default Timezone provider.
- Disposable
- A Disposable holds resources such as sockets and streams that need to be manually disposed.
-
Failure<
S extends Object, F extends Object> - Represents a failure.
- FakeRandom
- A fake Random implementation that always produces a given sequence of values. It should only be used in tests.
- FakeRuntime
- Creates a FakeRuntime for testing.
-
Group<
E> - A namespace for functions that group an Iterable's elements.
-
Interval<
T extends Comparable< Object?> > -
An Interval represents a convex (contiguous) portion of a domain bounded on both ends, i.e.
{ x | min < x < max }
. -
IterableRange<
T extends Comparable< Object?> > - A Range that is also iterable.
-
ListMove<
E> - A namespace for functions that move a List's elements to other collections.
- LocalDate
-
A date without a timezone, as seen in a calendar, such as
2023-04-11
. - LocalDateTime
-
A date-time without a timezone, such as
2023-04-10 09:30
. - LocalTime
-
The time of the day without a timezone, as seen on a wall clock, such as.
12:30
. -
Max<
T extends Comparable< Object?> > -
A Max represents a convex (contiguous) portion of a domain bounded on the upper end, i.e.
{ x | x < value }
. -
Min<
T extends Comparable< Object?> > -
A Min represents a convex (contiguous) portion of a domain bounded on the lower end, i.e.
{ x | value < x }
. - NotTested
- Denotes that the annotated element is not tested.
- Offset
- An offset is the time difference between a timezone and UTC.
- OffsetTime
-
The time of the day with an offset from UTC/Greenwich, such as
10:15+08:00
. -
Order<
E, T extends Comparable< Object> > - A namespace for functions that order an Iterable's elements.
- Period
- A Period represents a quantity of time in terms of its individual parts.
- Possible
- Denotes that an annotated element may return the given error codes or throw the given exceptions.
-
Range<
T extends Comparable< Object?> > - A Range represents a convex (contiguous) portion of a domain.
-
Result<
S extends Object, F extends Object> - A Result represents the result of an operation. It is a Success or Failure.
- Runtime
- Provides a platform agnostic way to retrieve information about the platform.
-
SetMove<
E> - A namespace for functions that move a Set's elements to other collections.
-
Split<
E> - A namespace for functions that split an Iterable's elements.
-
Success<
S extends Object, F extends Object> - Represents a success.
- TemporalUnit
- A unit of date-time, such as days or hours.
- Timezone
- A timezone that contains rules defining how an offset varies for a single timezone.
- TimezoneSpan
- A TimezoneSpan contains information about a timezone between two points in time.
-
Unbound<
T extends Comparable< Object?> > -
An Unbound interval represents a convex (contiguous) portion of a domain unbounded on both ends, i.e.
{ x | x }
. - ZonedDateTime
-
A date-time with a timezone such as
2023-04-13 10:15:30+08:00 Asia/Singapore
.
Enums
- DateUnit
- A unit of date, such as months and days.
- PlatformType
- The platform's type.
- TimeUnit
- A unit of time, such as hours and minutes.
Extensions
-
AggregateComparableIterable
on Iterable<
E> - Provides ordering functions for Iterables of Comparables.
-
AggregateIterable
on Iterable<
E> - Provides aggregate functions for Iterables.
-
AggregateNumberIterable
on Iterable<
E> - Provides aggregate functions for Iterables of nums.
- Bools on bool
- Provides functions for working with booleans.
-
Comparators
on Comparator<
T> - Provides functions for working with Comparators.
- Dates on Never
- Provides low-level functions for working with dates.
- DateTimes on DateTime
- Provides functions for working with in-built DateTimes.
-
DeepEqualityIterable
on Iterable<
Object?> - Provides functions for determining the deep equality of Iterables.
-
DeepEqualityMap
on Map<
Object?, Object?> - Provides functions for determining the deep equality of Maps.
-
DeepEqualityMapEntry
on MapEntry<
Object?, Object?> - Provides functions for determining the deep equality of MapEntrys.
- Doubles on double
- Provides functions for working with doubles.
- Equality on Never
- Provides functions that determine the deep equality of objects.
-
FutureMaybe
on Future<
T?> -
Provides functions for working with asynchronous
Maybe
s. -
GroupableIterable
on Iterable<
E> - Provides functions for grouping an Iterable's elements.
- HashCodes on Never
- Provides functions that compute the deep hashcodes of objects.
- Integers on int
- Provides functions for working with ints.
-
IterableIterable
on Iterable<
Iterable< E> > - Provides functions for working with nested iterables.
-
Iterables
on Iterable<
E> - Provides functions for transforming Iterables to other collections.
-
Lists
on List<
E> - Provides functions for working with Lists.
-
Maps
on Map<
K, V> - Provides functions for working with Maps.
- Maybe on T?
-
A Maybe monad that may or may not contain a
T
. -
MovableList
on List<
E> - Provides functions for moving elements in lists to other collections.
-
MovableSet
on Set<
E> - Provides functions for moving elements in sets to other collections.
-
NonNullableList
on List<
E> - Provides functions for working with Lists of null-nullable elements.
-
NonNullableMap
on Map<
K, V> - Provides functions for working with Maps with null-nullable entries.
-
NonNullableSet
on Set<
E> - Provides functions for working with Sets of null-nullable elements.
-
OrderableIterable
on Iterable<
E> - Provides functions for ordering an Iterable.
- Randoms on Random
- Provides functions for using Randoms.
-
Sets
on Set<
E> - Provides functions for working with Sets.
-
SplittableIterable
on Iterable<
E> - Provides functions for splitting an Iterable into parts.
- StringBuffers on StringBuffer
- Provides functions for working with StringBuffers.
- Strings on String
- Provides functions that manipulate Strings.
- Times on Never
- Provides low-level functions for working with times.
Constants
- lazy → const _Lazy
- Denotes that the annotated element is lazy.
Functions
-
defaultPlatformTimezoneProvider(
) → String - The default platform timezone provider.
-
disjoint(
Iterable< Object?> a, Iterable<Object?> b) → bool -
Returns true if
a
andb
have no common elements. -
max<
T> (T a, T b, {Select< T, Comparable< ? by}) → TObject> > -
Returns the greater of
a
andb
. -
min<
T> (T a, T b, {Select< T, Comparable< ? by}) → TObject> > -
Returns the lesser of
a
andb
. -
reverse(
List< Object?> list, [int start = 0, int? end]) → void -
Reverses a list, or part of between
start
, inclusive andend
, exclusive, in-place. -
separate<
E> (List< E> list, {required List<E> by}) → List<E> -
Returns a copy of the
list
with its elements separated by those inby
.
Typedefs
- Callback = void Function()
- A callback that has no arguments and returns nothing.
-
Consume<
T> = void Function(T value) - An operation that accepts a single argument and returns nothing.
- DayMicroseconds = int
- The microseconds in a day since midnight.
- DayMilliseconds = int
- The milliseconds in a day since midnight.
- DaySeconds = int
- The seconds in a day since midnight.
- EpochDays = int
- The days since Unix epoch, 1st January 1970.
- EpochMicroseconds = int
- The microseconds since Unix epoch, 1st January 1970.
- EpochMilliseconds = int
- The milliseconds since Unix epoch, 1st January 1970.
- EpochSeconds = int
- The seconds since Unix epoch, 1st January 1970.
-
Predicate<
T> = bool Function(T value) - A predicate (boolean-valued function) of one argument.
-
Select<
T, R> = R Function(T value) - A selector of one argument.
-
Supply<
T> = T Function() -
A supplier of
T
s.
Exceptions / Errors
- ArithmeticException
- Thrown when an exceptional arithmetic condition has occurred.