micha_core library

Enums

SgrCode
Select Graphic Rendition, applied in format: CSI n m

Extensions

AnsiFormatting on String
String formatting methods using ANSI escape sequences. Primarily useful for logging to consoles. Bright colors are not included, because they are not supported by all terminals.
ByNameOrNull on Iterable<T>
Clamp on Duration
IterableNullWhenEmpty on TIterable
IterableSeparated on Iterable<T>
IterableSplit on Iterable<T>
ListSeparated on List<T>
Functions are identical to those of IterableSeparated. Results are converted to lists, so the original list is not modified.
ListSplit on List<T>
Functions are identical to those of IterableSplit. Results are converted to lists, so the original list is not modified.
MapNullWhenEmpty on TMap
StringNullWhenEmpty on String
Times on int
Transform on TOrigin
Wrapped on T

Constants

ansiEscape → const String
ANSI escape character, indicating the beginning of an ANSI escape sequence
controlSequenceIntroducer → const String

Functions

createExponentialBackoff({Duration initialDelay = const Duration(seconds: 1), Duration maxDelay = const Duration(seconds: 30)}) RetryStrategy
Returns a function to calculate a delay that exponentially increases with each attempt. The delay starts at initialDelay and exponentially doubles until maxDelay is reached.
createLogger(Type t) → Logger
Recommended way to create a new Logger for a given type.
createNamedLogger(String name) → Logger
Create a new Logger for a given name. Not recommended. Use createLogger instead, if possible.
initLogging({Level projectLogLevel = Level.ALL, Level dependenciesLogLevel = Level.WARNING}) → void
Initialize logging. Should be called before runApp, if logging is used.
retried<T, TException extends Object>(FutureOr<T> operation(), {int? maxAttemptCount = 3, RetryStrategy? strategy, bool shouldRetry(TException exception)?, Future<void> waitForDuration(Duration duration) = Future<void>.delayed}) Future<T>
Retries a given operation until it succeeds and forwards the return value. A call is attempted at least once and at most maxAttemptCount times.
waitFor(FutureOr<bool> condition(), {Duration? timeout, Duration interval = const Duration(milliseconds: 200), DateTime nowProvider() = DateTime.now, Future<void> waitForDuration(Duration duration) = Future<void>.delayed}) Future<void>
Repeatedly calls and waits until condition returns true.

Typedefs

BuilderCallback<T> = Widget Function(BuildContext context, T data)
RetryStrategy = Duration Function(int attemptCount)
TimesCallback<T> = T Function(int index)

Exceptions / Errors

RetryException
Can be thrown with a custom delay that overrides the strategy in retried.