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.
- FakeSystem
- Creates a FakeSystem for testing.
-
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.
-
SetMove<
E> - A namespace for functions that move a Set's elements to other collections.
-
Sil<
E> - A String Index List (SIL) allows elements to be manipulated using a StringIndex and int index. Elements in a SIL must be unique.
-
Success<
S extends Object, F extends Object> - Represents a success.
- System
- Provides a platform agnostic way to retrieve information about the system.
- 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.
Extension Types
- Group
- A namespace for functions that group an Iterable's elements.
- SilByIndex
- A view for manipulating elements in an SIL by their integer index.
- SilByStringIndex
- A view for manipulating elements in an SIL by their string index.
- Split
- A namespace for functions that split an Iterable's elements.
- StringIndex
- Provides low-level functions for manipulating string indexes.
Extensions
-
AggregateComparableIterable
on Iterable<
E> - Provides ordering functions for Iterables of Comparables.
-
AggregateIterable
on Iterable<
E> - Provides aggregate functions, such as average and sum, for Iterables.
-
AggregateNumberIterable
on Iterable<
E> - Provides aggregate functions, such as average and sum, 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.
-
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.
-
Iterables
on Iterable<
E> - Provides functions for filtering and transforming Iterables into other collections.
-
Lists
on List<
E> - Provides functions for working with Lists.
-
Maps
on Map<
K, V> - Provides functions for working with Maps.
-
MovableList
on List<
E> - Provides functions for moving a list's elements to other collections.
-
MovableSet
on Set<
E> - Provides functions for moving a set's elements 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 of null-nullable entries.
-
NonNullableSet
on Set<
E> - Provides functions for working with Sets of null-nullable elements.
- NullableDoubles on double?
- Provides functions for working with nullable doubles, specifically their operator overloads which do not work with the null-aware operator.
- NullableIntegers on int?
- Provides functions for working with nullable ints, specifically their operator overloads which do not work with the null-aware operator.
- NullableNumbers on num?
- Provides functions for working with nullable nums, specifically their operator overloads which do not work with the null-aware operator.
- NullableObjects on Object?
- Provides functions for casting nullable Objects.
-
OrderableIterable
on Iterable<
E> - Provides functions for ordering an Iterable's elements.
- Randoms on Random
- Provides functions for using Randoms.
-
Sets
on Set<
E> - Provides functions for working with Sets.
-
SplayTreeMaps
on SplayTreeMap<
K, V> - Provides functions for working SplayTreeMaps.
-
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
aandbhave no common elements. -
max<
T> (T a, T b, {Select< T, Comparable< ? by}) → TObject> > -
Returns the greater of
aandb. -
min<
T> (T a, T b, {Select< T, Comparable< ? by}) → TObject> > -
Returns the lesser of
aandb. -
separate<
E> (List< E> list, {required List<E> by}) → List<E> -
Returns a copy of the
listwith 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
Ts.
Exceptions / Errors
- ArithmeticException
- Thrown when an exceptional arithmetic condition has occurred.