commons library

Classes

Assert
A decorator that allows adding assert(...) on the generated classes.
BehaviorSubjectRxVar<T>
BiDi<A, B>
Cache<K, V>
CachedFr<T, K, C, F extends Fr<T>>
CachedFu<T, K, C, F extends Fw<T>>
Compose
DeepCollectionEquality
Deep equality on collections.
Default
Allows passing default values to a constructor:
Disposable
DspImpl
DspReg
EqualUnmodifiableListView<T>
An UnmodifiableListView which overrides ==
EqualUnmodifiableMapView<Key, Value>
An UnmodifiableMapView which overrides ==
EqualUnmodifiableSetView<T>
An UnmodifiableSetView which overrides ==
FileStore
Fr<T>
Freezed
Flags a class as needing to be processed by Freezed and allows passing options.
FreezedMapOptions
Options for enabling/disabling specific Union.map features;
FreezedUnionValue
An annotation used to specify how a union type will be serialized.
FreezedWhenOptions
Options for enabling/disabling specific Union.when features;
Fu<T>
Futures
Fw<T>
Has
HasDefault
HasMfw<M extends GeneratedMessage>
HasName
HasPayload<T>
HasThisType
Immutable
Used to annotate a class.
Implements<T extends Object?>
Marks a union type to implement the interface stringType or type T. In the case below City will implement AdministrativeArea<House>.
IndexedParentReference<P>
JsonConverter<T, S>
Implement this class to provide custom converters for a specific Type.
JsonEnum
Allows configuration of how enum elements are treated as JSON.
JsonKey
An annotation used to specify how a field is serialized.
JsonLiteral
An annotation used to generate a private field containing the contents of a JSON file.
JsonSerializable
An annotation used to specify a class to generate code for.
JsonValue
An annotation used to specify how a enum value is serialized.
Late<T>
LatestExecutor<T extends Object>
Locker<T>
MhuLogger
ParseFailure<T>
ParseResult<T>
ParseSuccess<T>
PbIntMapKey
PbMapKey
PbStringMapKey
RefCountPool<K, V>
Required
Used to annotate a named parameter p in a method or function f.
ResourceIdentifier
Annotates a static method as referencing a native resource.
RxVal<T>
RxVar<T>
SetDiff<T>
SingleElementIterable<E>
TaskQueue
TypedCache
TypedKey<T>
UseResult
See useResult for more details.
With<T extends Object?>
Marks a union type to mixin the interface stringType or type T. In the case below City will mixin with AdministrativeArea<House>.

Enums

FieldRename
Values for the automatic field renaming behavior for JsonSerializable.
FreezedUnionCase
Options for automatic union values renaming.

Mixins

HasFr<T>
HasFu<T>
HasFw<T>
HasNext<T>
HasParent<T>
HolderMixin<T>

Extensions

AcquireX on Future<T> Function(DspReg disposers)
AsyncCallbackX on Future<void> Function(T value)
BiDiOptX on BiDiOpt<A, B>
BiDiX on BiDi<A, B>
CallbackX on void Function(T)
CompareAnyX on T
CompleterX on Completer<T>
DisposableX on Disposable
FilePathX on FilePath
FrCommonListX on Fr<List<V>>
FrCommonMapX on Fr<Map<K, V>>
FrpDisposersX on DspReg
FrpStreamX on Stream<T>
FrX on Fr<T>
FuCommonListX on Fu<List<V>>
FuCommonMapX on Fu<Map<K, V>>
FwProtoX on Fw<M>
FwX on Fw<T>
HasNextX on T
HasParentNullableX on T?
HasPayloadX on Iterable<HasPayload<T>>
IterableFuturesX on Iterable<Future<T>>
MathIterableX on Iterable<T>
MhuBaseGeneratedMessageX on M
MhuByteListX on List<int>
MhuComparableGetterX on V Function(T object)
MhuComparatorFieldFunctionX on F Function(T t)
MhuComparatorNotNullableX on Comparator<T>
MhuComparatorX on Comparator<T>
MhuDisposeAnyX on T
MhuDisposerFutureX on Future<T>
MhuDisposerStreamControllerX on StreamController<T>
MhuDoubleIterableX on Iterable<double>
MhuEnumX on T
MhuGenericsX on T
MhuIterableAnyX on T
MhuIterableNumberExtension on Iterable<num>
MhuIterableX on Iterable<T>
MhuIteratorX on Iterator<T>
MhuKtAnyX on T
MhuMapEntryAnyX on T
MhuMapIterableX on Iterable<T>
MhuMapOfRequiredValueX on Map<K, V>
MhuProtoEnumX on T
MhuRxValX on RxVal<T>
MhuRxVarX on RxVar<T>
MhuStreamOfIterablesX on Stream<Iterable<T>>
MhuStreamX on Stream<T>
MhuStringX on String
NullabeIterableX on T?
ParseResultX on ParseResult<T>
PbMapKeyX on PbMapKey
ServiceStreamOfISetX on Stream<ISet<K>>
StreamOfISetX on Stream<ISet<T>>
StreamSubscriptionX on StreamSubscription<T>
TypedKeyObjectX on Object
TypeFunctionX on TypeFunction<TF>

Constants

alwaysThrows → const _AlwaysThrows
Used to annotate a function f. Indicates that f always throws an exception. Any functions that override f, in class inheritance, are also expected to conform to this contract.
checked → const _Checked
Used to annotate a parameter of an instance method that overrides another method.
doNotStore → const _DoNotStore
Used to annotate a method, getter or top-level getter or function to indicate that the value obtained by invoking it should not be stored in a field or top-level variable. The annotation can also be applied to a class to implicitly annotate all of the valid members of the class, or applied to a library to annotate all of the valid members of the library, including classes. If a value returned by an element marked as doNotStore is returned from a function or getter, that function or getter should be similarly annotated.
doNotSubmit → const _DoNotSubmit
Used to annotate a method, getter or top-level getter or function that is not intended to be accessed in checked-in code, but might be ephemerally used during development or local testing.
experimental → const _Experimental
Used to annotate a library, or any declaration that is part of the public interface of a library (such as top-level members, class members, and function parameters) to indicate that the annotated API is experimental and may be removed or changed at any-time without updating the version of the containing package, despite the fact that it would otherwise be a breaking change.
factory → const _Factory
Used to annotate an instance or static method m. Indicates that m must either be abstract or must return a newly allocated object or null. In addition, every method that either implements or overrides m is implicitly annotated with this same annotation.
freezed → const Freezed
freezedStruct → const Freezed
immutable → const Immutable
Used to annotate a class C. Indicates that C and all subtypes of C must be immutable.
internal → const _Internal
Used to annotate a declaration which should only be used from within the package in which it is declared, and which should not be exposed from said package's public API.
isTest → const _IsTest
Used to annotate a test framework function that runs a single test.
isTestGroup → const _IsTestGroup
Used to annotate a test framework function that runs a group of tests.
literal → const _Literal
Used to annotate a const constructor c. Indicates that any invocation of the constructor must use the keyword const unless one or more of the arguments to the constructor is not a compile-time constant.
mustBeConst → const _MustBeConst
Used to annotate a parameter which should be constant.
mustBeOverridden → const _MustBeOverridden
Used to annotate an instance member m declared on a class or mixin C. Indicates that every concrete subclass of C must directly override m.
mustCallSuper → const _MustCallSuper
Used to annotate an instance member (method, getter, setter, operator, or field) m. Indicates that every invocation of a member that overrides m must also invoke m. In addition, every method that overrides m is implicitly annotated with this same annotation.
nonVirtual → const _NonVirtual
Used to annotate an instance member (method, getter, setter, operator, or field) m in a class C or mixin M. Indicates that m should not be overridden in any classes that extend or mixin C or M.
optionalTypeArgs → const _OptionalTypeArgs
Used to annotate a class, mixin, extension, function, method, or typedef declaration C. Indicates that any type arguments declared on C are to be treated as optional.
protected → const _Protected
Used to annotate an instance member in a class or mixin which is meant to be visible only within the declaring library, and to other instance members of the class or mixin, and their subtypes.
redeclare → const _Redeclare
Used to annotate an instance member of an extension type that redeclares a member from a superinterface.
reopen → const _Reopen
Annotation for intentionally loosening restrictions on subtyping that would otherwise cause lint warnings to be produced by the implicit_reopen lint.
required → const Required
Used to annotate a named parameter p in a method or function f. Indicates that every invocation of f must include an argument corresponding to p, despite the fact that p would otherwise be an optional parameter.
sealed → const _Sealed
Annotation marking a class as not allowed as a super-type outside of the current package.
unfreezed → const Freezed
Defines a potentially mutable data-class.
useResult → const UseResult
Used to annotate a method, field, or getter within a class, mixin, or extension, or a or top-level getter, variable or function to indicate that the value obtained by invoking it should be used. A value is considered used if it is assigned to a variable, passed to a function, or used as the target of an invocation, or invoked (if the result is itself a function).
virtual → const _Virtual
Used to annotate a field that is allowed to be overridden in Strong Mode.
visibleForOverriding → const _VisibleForOverriding
Used to annotate an instance member that was made public so that it could be overridden but that is not intended to be referenced from outside the defining library.
visibleForTesting → const _VisibleForTesting
Used to annotate a declaration that was made public, so that it is more visible than otherwise necessary, to make code testable.

Properties

logger → Logger
final

Functions

$checkedConvert<T>(Map map, String key, T castFunc(dynamic), {Object? readValue(Map, String)?}) → T
Helper function used in generated code when JsonSerializableGenerator.checked is true.
$checkedCreate<T>(String className, Map map, T constructor(S <S>(String, S (Object?), {Object? readValue(Map, String)?})), {Map<String, String> fieldKeyMap = const {}}) → T
Helper function used in generated code when JsonSerializableGenerator.checked is true.
$checkedNew<T>(String className, Map map, T constructor(), {Map<String, String>? fieldKeyMap}) → T
Helper function used in generated code when JsonSerializableGenerator.checked is true.
$checkKeys(Map map, {List<String>? allowedKeys, List<String>? requiredKeys, List<String>? disallowNullValues}) → void
Helper function used in generated fromJson code when JsonSerializable.disallowUnrecognizedKeys is true for an annotated type or JsonKey.required is true for any annotated fields.
$enumDecode<K extends Enum, V>(Map<K, V> enumValues, Object? source, {K? unknownValue}) → K
Returns the key associated with value source from enumValues, if one exists.
$enumDecodeNullable<K extends Enum, V>(Map<K, V> enumValues, Object? source, {Enum? unknownValue}) → K?
Returns the key associated with value source from enumValues, if one exists.
compare2<T>(Comparator<T> c1, Comparator<T> c2) Comparator<T>
compare3<T>(Comparator<T> c1, Comparator<T> c2, Comparator<T> c3) Comparator<T>
compareByField<T, F extends Comparable<F>>(F fieldValue(T t)) Comparator<T>
compareByFieldNatural<T, F>(F fieldValue(T t), {Comparator<F> comparator = compareNaturalOrder}) Comparator<T>
compareByFieldNum<T>(num fieldValue(T t)) Comparator<T>
compareMany<T>(Iterable<Comparator<T>> comparators) Comparator<T>
compareNaturalOrder(dynamic a, dynamic b) int
compareTo<C extends Comparable<C>>(C a, C b) int
compareToNum(num a, num b) int
constantFalse() bool
constrainOrNull<T extends num>(T input, T min, T max) → T?
createDoubleRoughlyEqual(double epsilon) bool Function(double a, double b)
decimalParseFunction(String source) ParseResult<Decimal>
doubleEqualWithin3Decimals(double a, double b) bool
doubleParseFunction(String string) ParseResult<double>
doubleRoughlyEqual(double a, double b, double epsilon) bool
dtbRandomString({int length = 20, String chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890'}) String
empty0<T>() Iterable<T>
empty1<T>(dynamic p0) Iterable<T>
flcCachedFileLoader<K>({required FileLoader<K> loader, required FileStore store, required FilePath pathProvider(K key)}) FileLoader<K>
fr<T>(T calc(), {DspReg? disposers}) Fr<T>
frDsp<T>(T calc(DspReg disposers), {DspReg? dsp}) Fr<T>
fru<M extends GeneratedMessage, F>(Fw<M> fw, F get(M m), {DspReg? disposers}) Fu<F>
frw<T>(Fr<T> fr, void set(T v)) Fw<T>
fw<T>(T value, {DspReg? disposers}) Fw<T>
identity<T>(T value) → T
ignore1(dynamic p0) → void
infiniteSingleElementIterator<T>(T element) Iterable<T>
int64ParseFunction(String string) ParseResult<Int64>
intCompare(int a, int b) int
integers({int from = 0}) Iterable<int>
intParseFunction(String string) ParseResult<int>
iterableCompare<E extends Comparable<E>>(Iterable<E> a, Iterable<E> b) int
iterableCompareNaturalOrder<E>(Iterable<E> a, Iterable<E> b, {Comparator<E> comparator = compareNaturalOrder}) int
lazy<T>(T factory()) Late<T>
max2<T>(T a, T b, [Comparator<T> comparator = compareNaturalOrder]) → T
millisSinceEpochToDisplayString(double millisSinceEpoch) String
min2<T>(T a, T b, [Comparator<T> comparator = compareNaturalOrder]) → T
nextPowerOf2(int value) int
nullFirst<T extends Object>(Comparator<T> comparator) Comparator<T?>
nullLast<T extends Object>(Comparator<T> comparator) Comparator<T?>
reversedIntCompare(int a, int b) int
run<T>(T fn()) → T
rxw<T>(T initial, {DspReg? dsp}) RxVar<T>
throws0() → Never
throws1(dynamic p0) → Never
tryParseDecimal(String string) → Decimal?

Typedefs

AsyncFunction<T> = Future<T> Function()
AsyncVoidFunction = AsyncFunction<void>
BiDiOpt<A, B> = BiDi<A?, B?>
DisposeAction = FutureOr<void> Function()
FileLoader<K> = Future<Uint8List> Function(K path)
FilePath = IList<String>
FilePathProvider<K> = FilePath Function(K key)
IntMapEntry<T> = MapEntry<int, T>
Lazy<T> = T Function()
ListFu<V> = CachedFu<V, int, List<V>, Fw<V>>
MapFu<K, V> = CachedFu<V, K, Map<K, V>, Fw<V>>
Mfw<M extends GeneratedMessage> = Fw<M>
ParseFunction<T> = ParseResult<T> Function(String string)
StringMapEntry<T> = MapEntry<String, T>
TypeFunction<TF> = R Function<R>(R fn<T extends TF>())
Watch<T> = T Function()
Watch1<T, P1> = T Function(P1 p1)

Exceptions / Errors

BadKeyException
A base class for exceptions thrown when decoding JSON.
CheckedFromJsonException
Exception thrown if there is a runtime exception in fromJson code generated when JsonSerializableGenerator.checked is true
DisallowedNullValueException
Exception thrown if there are keys with disallowed null values in a JSON map that was provided during deserialization.
MhuException
MissingRequiredKeysException
Exception thrown if there are missing required keys in a JSON map that was provided during deserialization.
UnrecognizedKeysException
Exception thrown if there are unrecognized keys in a JSON map that was provided during deserialization.