stormy_core library

Classes

AdapterSpec<T>
Configuration that specifies the generation of a TypeAdapter
AnsiPen
Pen attributes for foreground and background colors.
AnyNotifier<StateT, ValueT> Notifiers
A base class for all "notifiers".
AppLifecycleManager
App 生命周期管理器 - 单例模式
AppLifecycleStateListener
App 生命周期状态监听器
AsyncData<ValueT> Core
Creates an AsyncValue with a data.
AsyncError<ValueT> Core
Creates an AsyncValue in the error state.
AsyncLoading<ValueT> Core
Creates an AsyncValue in loading state.
AsyncNotifier<StateT> Notifiers
A Notifier implementation that is asynchronously initialized.
AsyncNotifierProvider<NotifierT extends AsyncNotifier<ValueT>, ValueT> Providers
A provider which creates and listen to an AsyncNotifier.
AsyncResult<ValueT>
A variant of AsyncValue that excludes AsyncLoading.
AsyncValue<ValueT> Core
A utility for safely manipulating asynchronous data.
AuthInterceptor
鉴权与动态头拦截器 负责全局的 Token 和 Header 分发管理,支持异步等待直至配置完成才发起请求
BackgroundTransformer
The default Transformer for Dio.
BaseOptions
A set of base settings for each Dio(). BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
BinaryReader
The BinaryReader is used to bring data back from the binary format on the disk.
BinaryWriter
The BinaryWriter is used to encode data to the binary format.
Box<E>
Boxes contain all of your data. In the browser, each box has its own IndexedDB database. On all other platforms, each Box is stored in a separate file in the Hive home directory.
BoxBase<E>
Boxes contain all of your data. In the browser, each box has its own IndexedDB database. On all other platforms, each Box is stored in a seperate file in the Hive home directory.
BoxCollection
TODO: Document this!
BoxEvent
A event representing a change in a box.
CancelToken
Controls cancellation of Dio's requests.
CollectionBox<V>
represents a Box being part of a BoxCollection
ColoredLoggerFormatter
This formatter makes messages colorful if this setting is enabled in the settings TalkerLoggerSettings
ConsoleUtils
Class that contains methods for working with console output
DataParser<T>
数据解析器抽象基础协议 专门用于处理经过 ResponseParser 基础脱壳后(即抛弃了最外层 code、message 后)的纯净业务 Data。
DefaultTalkerHistory
Base implementation of TalkerHistory to save the history locally
DependencyGraph
依赖分析器 — 封装拓扑排序和循环依赖检测
Dio
Dio enables you to make HTTP requests easily.
DioMixin
DirectParser<T>
直接透传解析器 不进行任何映射,直接泛型强转。适用于外部不需要模型转换的快速开发场景。
ErrorHandler
全局错误处理器
ErrorInterceptorHandler
The handler for interceptors to handle error occurred during the request.
ExtendedLoggerFormatter
This formatter makes messages colorful if this setting is enabled in the settings TalkerLoggerSettings
FormData
A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
FuncUtils
函数工具类
FusedTransformer
A Transformer that has a fast path for decoding UTF8-encoded JSON. If the response is utf8-encoded JSON and no custom decoder is specified in the RequestOptions, this transformer is significantly faster than the default SyncTransformer and the BackgroundTransformer. This improvement is achieved by using a fused Utf8Decoder and JsonDecoder to decode the response, which is faster than decoding the utf8-encoded JSON in two separate steps, since Dart uses a special fast decoder for this case. See https://github.com/dart-lang/sdk/blob/5b2ea0c7a227d91c691d2ff8cbbeb5f7f86afdb9/sdk/lib/_internal/vm/lib/convert_patch.dart#L40
FutureProvider<ValueT> Providers
A provider that asynchronously creates a value.
GenerateAdapters
Annotation to generate TypeAdapters for the given specs
Headers
The headers class for requests and responses.
HiveAesCipher
Default encryption algorithm. Uses AES256 CBC with PKCS7 padding.
HiveCipher
Abstract cipher can be implemented to customize encryption.
HiveCollection<E extends HiveObjectMixin>
List containing HiveObjectMixins.
HiveField
Annotate all fields you want to persist with HiveField.
HiveInterface
The main API interface of Hive. Available through the Hive constant.
HiveList<E extends HiveObjectMixin>
Allows defining references to other HiveObjectMixins.
HiveObject
TODO: Document this!
HiveType
Annotate classes with HiveType to generate a TypeAdapter.
HttpClientAdapter
HttpAdapter is a bridge between Dio and HttpClient.
Interceptor
Interceptor helps to deal with RequestOptions, Response, and DioException during the lifecycle of a request before it reaches users.
Interceptors
A Queue-Model list for Interceptors.
InterceptorsWrapper
A helper class to create interceptors in ease.
IsolatedBox<E>
Isolated version of Box
IsolatedBoxBase<E>
Isolated version of BoxBase
IsolatedCompactionStrategy
A sendable description of a CompactionStrategy
IsolatedHiveInterface
Interface for IsolatedHive
IsolatedLazyBox<E>
Isolated version of LazyBox
IsolateNameServer
An abstraction of the IsolateNameServer
IStorageEngine
存储引擎规范,定义底层具体实现的存储驱动(如 Hive、SharedPreferences)行为
JsonListParser<T>
标准 JSON 列表解析器 用于解析 [ { "id": 1 }, { "id": 2 } ] 格式的列表。
JsonPageParser<T>
标准分页列表解析器 用于解析结构如: { "list": [{...}, {...}], "page": 1, "total": 100 } 或 { "content": [{...}], "page": { "number": 1, "totalElements": 100 } }
JsonParser<T>
标准 JSON 对象解析器 用于解析 { "id": 1, "name": "foo" } 格式的对象。
LazyBox<E>
LazyBoxes don't keep the values in memory like normal boxes. Each time a value is read, it is loaded from the backend.
LevelLogFilter
日志等级过滤器
ListParam<T>
Indicates a param being used as queries or form data, and how does it gets formatted.
LogDetails
A class for transporting data about an log message
LogFilter
日志过滤器接口
LoggerFilter
Abstract filter for messages logging.
LoggerFormatter
Responsible for formatting message before output
LoggingInterceptor
日志拦截器工厂类 封装 TalkerDioLogger 以便提供高颜值且符合项目规范的日志
LogInterceptor
LogInterceptor is used to print logs during network requests. It should be the last interceptor added, otherwise modifications by following interceptors will not be logged. This is because the execution of interceptors is in the order of addition.
LogLevelFilter
This filter checks that current message level is above certain LogLevel setting in TalkerLoggerSettings
LogSettings
日志配置类
MoneyFormat
MultipartFile
An upload content that is a part of MultipartRequest. This doesn't need to correspond to a physical file.
Notifier<ValueT> Notifiers
A class which exposes a state that can change over time.
NotifierProvider<NotifierT extends Notifier<ValueT>, ValueT> Providers
A provider that exposes a synchronous Notifier.
Options
The configuration for a single request. BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
PaginatedResult<T>
分页包装结果
PaginationMeta
分页元数据信息
PrefixLogFilter
日志前缀过滤器
PreloadConfig
预加载全局配置
PreloadEngine
预加载执行引擎 — 封装任务验证、依赖解析、执行、重试逻辑
PreloadExecutionResult
预加载执行结果
PreloadManager
预加载管理器 — Facade 模式,负责任务注册、状态流转、对外 API
PreloadProgress
预加载进度信息
PreloadSemaphore
并发控制信号量 — 实现真正的并发数限制 修复原设计中 maxConcurrentTasks 定义但从未生效的问题
PreloadTask<T>
预加载任务 — 通用任务模型
PreloadTracker
进度追踪器 — 监听任务状态变更,计算并推送进度更新
Provider<ValueT> Providers
A provider that exposes a read-only value.
ProviderContainer Core
An object that stores the state of the providers and allows overriding the behavior of a specific provider.
ProviderObserver Core
An object that listens to the changes of a ProviderContainer.
ProviderObserverContext Core
Information about the ProviderObserver event.
ProviderReference
The response of ProviderContainer.allProviders.
ProviderSubscription<OutT> Core
Represents the subscription to a ProviderListenable.
QueuedInterceptor
Interceptor in queue.
QueuedInterceptorsWrapper
A helper class to create QueuedInterceptor in ease.
RedirectRecord
A record that records the redirection happens during requests, including status code, request method, and the location.
Ref Core
An object used by providers to interact with other providers and the life-cycles of the application.
RequestInterceptorHandler
The handler for interceptors to handle before the request has been sent.
RequestOptions
The internal request option class that is the eventual result after BaseOptions and Options are composed.
Response<T>
The Response class contains the payload (could be transformed) that respond from the request, and other information of the response.
ResponseBody
The response wrapper class for adapters.
ResponseInterceptorHandler
The handler for interceptors to handle after respond.
ResponseParser
响应字段解析器 用于根据配置拆包外层格式,提取真实 data,或报错抛出业务异常。
ResponseParsingConfig
响应字段解析配置
RetryInterceptor
请求重试拦截器 当发生网络层错误进行有限策略重试
StorageBucket
StorageBucketAccessor
分区访问控制器代理类
StorageEntry<T>
存储条目 - 用于封装带过期时间的数据
StormyListStorage<T>
专门用于处理列表数据的存储封装
StormyLog
日志工具类
StormyNetworkClient
Stormy 统一业务底层网络请求客户端
StormyNetworkConfig
网络配置类
StormyServices
Optional default services; applications can also own independent clients.
StormyStorage
StormyStorage - 统一存储总控入口 采用面相对象模型与 Accessor 返回隔离实例执行工作。 StormyStorage 本身混入了 StorageOperations,可以直接对设定的 Default Bucket 操作键值对。
StormyStorageConfig
Storage Config - 存储配置 用于配置本地存储的相关参数
StreamNotifier<ValueT> Notifiers
A variant of AsyncNotifier which has build creating a Stream.
StreamNotifierProvider<NotifierT extends StreamNotifier<ValueT>, ValueT> Providers
A provider which creates and listen to an StreamNotifier.
StreamProvider<ValueT> Providers
Creates a stream and exposes its latest event.
SyncTransformer
If you want to custom the transformation of request/response data, you can provide a Transformer by your self, and replace the transformer by setting the Dio.transformer.
Talker
Talker - advanced exception handling and logging for dart/flutter applications
TalkerData
Base Talker Data transfer object Objects of this type are passed through handlers observer and stream
TalkerDateTimeFormatter
Utility class for DateTime formatting.
TalkerError
Base implementation of TalkerData to handle ONLY Errors
TalkerErrorHandler
TalkerException
Base implementation of TalkerData to handle ONLY Exceptionss
TalkerFilter
TalkerHistory
Base class for create your own implementation of history
TalkerJsonFormatter
Formatter for converting data to pretty JSON strings.
TalkerKey
TalkerKey - String key of log type (After 5.0.0) TalkerLogType (Before 5.0.0)
TalkerLog
Base implementation of TalkerData to create Logs
TalkerLogger
TalkerLoggerSettings
Logger customization settings
TalkerObserver
Base observer class for to create your own observers
TalkerSettings
This class used for setup Talker configuration
TaskConfig
TaskExecutionContext
任务执行上下文 — 管理单个任务的执行状态 替代原 PreloadTask 的可变内部状态
Transformer
Transformer allows changes to the request/response data before it is sent/received to/from the server.
TypeAdapter<T>
Type adapters can be implemented to support non primitive values.
TypeLogFilter
日志类型过滤器
TypeRegistry
TypeRegistries contain the TypeAdapters associated with a typeId.
Uuid
uuid for Dart Author: Yulian Kuncheff Released under MIT License.
UuidUtils
UuidValue
WatchBoxBuilder
A general-purpose widget which rebuilds itself when the box or a specific key change.

Enums

AppLifecycleStatus
==================== App 生命周期事件 ==================== App 生命周期状态
DioExceptionType
The exception enumeration indicates what type of exception has happened during requests.
FileAccessMode
The file access mode when downloading a file, corresponds to a subset of dart:io::FileMode.
HiveStorageBackendPreference
declares the preferred JS StorageBackend to be used
ListFormat
Specifies the array format (a single parameter with multiple parameter or multiple parameters with the same name). and the separator for array items.
LogLevel
Level of logs to segmentation and control logging output
Namespace
RFC4122 & RFC9562 provided namespaces for v3, v5, and v8 namespace based UUIDs
PreloadManagerState
预加载管理器整体状态
PreloadResult
预加载结果
PreloadTaskState
预加载状态枚举
ResponseType
Indicates which transformation should be applied to the response data.
RetryDelayStrategy
重试延迟策略
TimeFormat
Enum representing different time formats.
ValidationMode
The options for UUID Validation strictness

Mixins

HiveObjectMixin
Extend HiveObject to add useful methods to the objects you want to store in Hive
OptionsMixin
The mixin class for options that provides common attributes.
StorageOperations

Extensions

AsyncValueExtensions on AsyncValue<ValueT>
Adds non-state related methods/getters to AsyncValue.
BoolNullSafety on bool?
bool空安全扩展
BoxX on Box<T>
Flutter extensions for boxes.
DoubleNullSafety on double?
double空安全扩展
FieldsToDisplay on TalkerData
Extension to get display text of TalkerData fields
HiveX on HiveInterface
Flutter extensions for Hive.
IntNullSafety on int?
int空安全扩展
IsolatedHiveX on IsolatedHiveInterface
Flutter extensions for IsolatedHiveInterface
LazyBoxX on LazyBox<T>
Flutter extensions for lazy boxes.
ListNullSafety on List?
List空安全扩展
PollUntilExt on Future?
ProviderListenableListenable on ProviderListenable<T>
Adds listenable to ProviderListenable.
ProviderListenableSelect on ProviderListenable<InT>
Adds select to ProviderListenable.
StringNullSafety on String?
String空安全扩展
TalkerDataInterfaceListExt on List<TalkerData>
TalkerIterableLogTypeModifier on Iterable<TalkerLogType>

Constants

ansi_default → const String
ansi_esc → const String
ansiDefault → const String
Reset all colors and options for current SGRs to terminal defaults.
ansiEscape → const String
ANSI Control Sequence Introducer, signals the terminal for new settings.
ansiResetBackground → const String
Ansi codes that default the terminal's background color without altering the foreground, when printed.
ansiResetForeground → const String
Ansi codes that default the terminal's foreground color without altering the background, when printed.
defaultLinearDelays → const List<Duration>
预定义延迟数组,用于 RetryDelayStrategy.linear

Properties

ansiColorDisabled ↔ bool
Globally enable or disable AnsiPen settings.
getter/setter pair
color_disabled ↔ bool
getter/setter pair
Hive → HiveInterface
Global constant to access Hive
final
IsolatedHive → IsolatedHiveInterface
Global constant to access IsolatedHive
final
logLevelPriorityList → List<LogLevel>
List of levels sorted by priority
final

Functions

defaultDioExceptionReadableStringBuilder(DioException e) → String
The default implementation of building a readable string of DioException.
isChineseName(String value) → bool
isEmail(String value) → bool
isIDCard(String idCard) → bool
isNumber(String value) → bool
isPhoneNumber(String phoneNumber) → bool
recursiveCall<T>({required Future<T> fn(), required bool condition(T), int maxRetry = 3, Duration retryDelay = const Duration(seconds: 1), Duration timeout = const Duration(seconds: 10), RetryDelayStrategy delayStrategy = RetryDelayStrategy.fixed, double delayFactor = 0.5, List<Duration> linearDelays = defaultLinearDelays}) → Future<T>
执行工厂函数 fn,重复创建新实例直到 condition 满足 fn 返回 Future 的工厂函数,每次重试都会重新调用 condition 满足条件,返回 true 时结束重试 maxRetry 最大重试次数 retryDelay 重试延迟(用于 RetryDelayStrategy.fixed 和 RetryDelayStrategy.exponential 的初始值) timeout 超时时间 delayStrategy 延迟策略,默认为 RetryDelayStrategy.fixed delayFactor 指数衰减的倍率因子(仅 RetryDelayStrategy.decay 生效),默认 0.5(每次减半) linearDelays 线性递增策略使用的延迟数组(仅 RetryDelayStrategy.linear 生效) 返回满足 condition 的结果
resetBackground() → String
resetForeground() → String
validateStorageKey(Object key) → void
Hive keys are strings or integers; their types must survive enumeration.

Typedefs

BoxWidgetBuilder<T> = Widget Function(BuildContext context, Box<T> box)
Signature for a function that builds a widget given a Box.
CompactionStrategy = bool Function(int entries, int deletedEntries)
A function which decides when to compact a box.
DefaultTransformer = SyncTransformer
DioError = DioException
DioError describes the exception info when a request failed.
DioErrorType = DioExceptionType
Deprecated in favor of DioExceptionType and will be removed in future major versions.
DioExceptionReadableStringBuilder = String Function(DioException e)
The readable string builder's signature of DioException.readableStringBuilder.
DioMediaType = MediaType
The type (alias) for specifying the content-type of the MultipartFile.
HeaderForEachCallback = void Function(String name, List<String> values)
The signature that iterates header fields.
HiveLogger = Logger
Hive's logger
HiveLoggerLevel = LoggerLevel
Hive's logger level
InterceptorErrorCallback = void Function(DioException error, ErrorInterceptorHandler handler)
The signature of Interceptor.onError.
InterceptorSendCallback = void Function(RequestOptions options, RequestInterceptorHandler handler)
The signature of Interceptor.onRequest.
InterceptorSuccessCallback = void Function(Response response, ResponseInterceptorHandler handler)
The signature of Interceptor.onResponse.
JsonDecodeCallback = FutureOr Function(String)
The callback definition for decoding a JSON string.
JsonEncodeCallback = FutureOr<String> Function(Object)
The callback definition for encoding a JSON object.
KeyComparator = int Function(dynamic key1, dynamic key2)
LoggerOutput = void Function(String message)
OnUnauthorized = Future<void> Function(DioException error)
ProgressCallback = void Function(int count, int total)
The type of a progress listening callback when sending or receiving data.
RequestEncoder = FutureOr<List<int>> Function(String request, RequestOptions options)
The type of a request encoding callback.
ResponseDecoder = FutureOr<String?> Function(List<int> responseBytes, RequestOptions options, ResponseBody responseBody)
The type of a response decoding callback.
RetryEvaluator = Future<bool> Function(DioException error, int attempt)
ValidateStatus = bool Function(int? status)
The type of a response status code validate callback.

Exceptions / Errors

AsyncValueIsLoadingException
AsyncValue.requireValue was called on an AsyncValue with no error nor a value.
BusinessException
业务层异常 (HTTP 状态码 200,但业务 code 不等于 successCode)
CircularDependencyException
循环依赖异常
ConnectionException
客户端网络或连接异常 (超时, 断网)
DioException
DioException describes the exception info when a request failed.
HiveError
An error related to Hive.
MappingException
泛型数据投射/结构映射异常
NetworkException
全局统一的网络异常基类
NotNullableError<T>
A TypeError thrown by _checkNotNullable.
ParserException
统一解析器异常
PreloadConfigException
配置异常
PreloadException
预加载相关异常
PreloadTaskFailedException
任务失败异常
PreloadTimeoutException
任务超时异常
ServerException
HTTP/服务端 异常 (例如 404, 500)
UnauthorizedException
授权异常 (例如 401 凭证失效)
UnknownException
未知异常