sm_core library

Classes

AdvancedFileOutput
Accumulates logs in a buffer to reduce frequent disk, writes while optionally switching to a new log file if it reaches a certain size.
AnsiColor
This class handles colorizing of terminal output.
APIConfig
默认配置, 在调用 APISession 之前, 必须先调用 APICore.initialize 才会生效
APICore
APIEnv
APIPageableLoader
APIPageableSession<T>
APIResponder<T>
APISession<T>
APIURL
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.
BoolConverter
CancelToken
Controls cancellation of Dio's requests.
ConsoleOutput
Default implementation of LogOutput.
CustomAnimation
DateTimeFormat
DevelopmentFilter
Prints all logs with level >= Logger.level while in development mode (eg when asserts are evaluated, Flutter calls this debug mode).
Dio
Dio enables you to make HTTP requests easily.
DioMixin
EasyLoading
EasyLoadingAnimation
ErrorInterceptorHandler
The handler for interceptors to handle error occurred during the request.
FileOutput
FlutterEasyLoading
FontSizeResolvers
FormData
A class to create readable "multipart/form-data" streams. It can be used to submit forms and file uploads to http server.
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
Headers
The headers class for requests and responses.
HttpClientAdapter
HttpAdapter is a bridge between Dio and HttpClient.
HybridPrinter
A decorator for a LogPrinter that allows for the composition of different printers to handle different log messages. Provide it's constructor with a base printer, but include named parameters for any levels that have a different printer:
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.
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.
ListParam<T>
Indicates a param being used as queries or form data, and how does it gets formatted.
LoadingAnimationWidget
LogEvent
LogFilter
An abstract filter of log messages.
LogfmtPrinter
Outputs a logfmt message:
Logger
Use instances of logger to send log messages to the LogPrinter.
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.
LogOutput
Log output receives a OutputEvent from LogPrinter and sends it to the desired destination.
LogPrinter
An abstract handler of log events.
MAlertDialog
MAppBar
MBottomSheet
MButton
MCircleAvatar
MContainer
MCupertinoActionSheet
MCupertinoActionSheetAction
MCupertinoAlertDialog
MCupertinoDialogAction
MCupertinoPopupSurface
MCustomStatus<T>
MDateFormat
MDialog
MElevatedButton
MemoryOutput
Buffers OutputEvents.
MEmptyStatus<T>
MErrorStatus<T, S>
MExpandable
Shows either the expanded or the collapsed child depending on the state. The state is determined by an instance of MExpandableController provided by ScopedModel
MExpandableButton
Toggles the state of MExpandableController when the user clicks on it.
MExpandableController
Controls the state (expanded or collapsed) of one or more Expandable. The controller should be provided to Expandable via MExpandableNotifier.
MExpandableIcon
An down/up arrow icon that toggles the state of MExpandableController when the user clicks on it. The model is accessed via ScopedModelDescendant.
MExpandableNotifier
Makes an MExpandableController available to the widget subtree. Useful for making multiple Expandable widgets synchronized with a single controller.
MExpandablePanel
A configurable widget for showing user-expandable content with an optional expand button.
MExpandableTheme
MExpandableThemeData
MFilledButton
MGetStatus<T>
MIconButton
MImage
MImageProvider
MListTile
MLoadingStatus<T>
MLogFilter
MLogger
ModalMBottomSheetRoute<T>
MOutlinedButton
MPrettyPrinter
MRefresh
MRichText
MScaffold
MScrollOnExpand
Ensures that the child is visible on the screen by scrolling the outer viewport when the outer MExpandableNotifier delivers a change event.
MSuccessStatus<T>
MText
MTextField
MTextSpan
MToast
MultiOutput
Logs simultaneously to multiple LogOutput outputs.
MultipartFile
An upload content that is a part of MultipartRequest. This doesn't need to correspond to a physical file.
Options
The configuration for a single request. BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
OutputEvent
PrefixPrinter
A decorator for a LogPrinter that allows for the prepending of every line in the log output with a string for the level of that log. For example:
PrettyPrinter
Default implementation of LogPrinter.
ProductionFilter
Prints all logs with level >= Logger.level even in production.
QueuedInterceptor
Interceptor in queue.
QueuedInterceptorsWrapper
A helper class to create QueuedInterceptor in ease.
RebuildFactors
REdgeInsets
REdgeInsetsDirectional
RedirectRecord
A record that records the redirection happens during requests, including status code, request method, and the location.
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.
RPadding
RSizedBox
ScreenUtil
ScreenUtilInit
SimplePrinter
Outputs simple log messages:
SMGetAppTranslation
SMWidgetAppTranslation
StreamOutput
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.
Transformer
Transformer allows changes to the request/response data before it is sent/received to/from the server.

Enums

APIEnvType
DeviceType
DioExceptionType
The exception enumeration indicates what type of exception has happened during requests.
EasyLoadingAnimationStyle
loading animation
EasyLoadingIndicatorType
loading indicator type. see https://github.com/jogboms/flutter_spinkit#-showcase
EasyLoadingMaskType
loading mask type none default mask type, allow user interactions while loading is displayed clear don't allow user interactions while loading is displayed black don't allow user interactions while loading is displayed custom while mask type is custom, maskColor should not be null
EasyLoadingStatus
loading status
EasyLoadingStyle
loading style
EasyLoadingToastPosition
toast position
FieldRename
Values for the automatic field renaming behavior for JsonSerializable.
FileAccessMode
The file access mode when downloading a file, corresponds to a subset of dart:io::FileMode.
HTTPMethod
Level
Levels to control logging output. Logging can be enabled to include all levels above certain Level.
ListFormat
Specifies the array format (a single parameter with multiple parameter or multiple parameters with the same name). and the separator for array items.
MBoxShape
MButtonIconAlignment
MErrorCode
MExpandablePanelBodyAlignment
Determines vertical alignment of the body
MExpandablePanelHeaderAlignment
Determines the alignment of the header relative to the expand icon
MExpandablePanelIconPlacement
Determines the placement of the expand/collapse icon in MExpandablePanel
MExpandableTransition
MImageRenderMethodForWeb
MTextFieldBorderStyle
MToastPosition
ResponseType
Indicates which transformation should be applied to the response data.

Mixins

APIDioMixin<T, E extends APIResponder<T>>
APIOptions<T>
MStateMixin<T>
OptionsMixin
The mixin class for options that provides common attributes.
SU

Constants

chatMaximumWidth → const double
consoleOutputLength → const int
designSize → const Size
errorMethodCount → const int
maximumFontScale → const double
maximumScale → const double
maximumScale1 → const double
methodCount → const int

Properties

aScaleHeight double
no setter
aScaleWidth double
no setter
bottomNavigationBarHeight double
no setter
designHeight double
no setter
designWidth double
no setter
imageScaleHeight double
no setter
imageScaleWidth double
no setter
kPrintable bool
是否打印日志, 默认为 kDebugMode
no setter
logger MLogger
final
pixelRatio double
no setter
safeBottom double
no setter
safeHeight double
no setter
safeTop double
no setter
scale double
no setter
scaleHeight double
no setter
scaleWidth double
no setter
screenHeight double
no setter
screenSize Size
no setter
screenUtil ScreenUtil
no setter
screenWidth double
no setter

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.
defaultDioExceptionReadableStringBuilder(DioException e) String
The default implementation of building a readable string of DioException.

Typedefs

DateTimeFormatter = String Function(DateTime time)
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.
EasyLoadingStatusCallback = void Function(EasyLoadingStatus status)
FontSizeResolver = double Function(num fontSize, ScreenUtil instance)
FromJsonT<T> = T Function(dynamic json)
HeaderForEachCallback = void Function(String name, List<String> values)
The signature that iterates header fields.
HTTPHeader = Parameters
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.
LogCallback = void Function(LogEvent event)
MErrorCallback<T> = void Function(T error)
MErrorListener = void Function(Object exception, StackTrace? stackTrace)
MErrorWidget = Widget Function(BuildContext context, String url, Object error)
MExpandableBuilder = Widget Function(BuildContext context, Widget collapsed, Widget expanded)
MImageErrorProviderBuilder = ImageProvider<Object> Function(BuildContext context, Object error, StackTrace? stackTrace)
MRefreshRequest = void Function(APIPageableLoader loader)
MValueChanged<T> = void Function(T value)
MVoidCallback = void Function()
OutputCallback = void Function(OutputEvent event)
Parameters = Map<String, dynamic>
ParseJsonT<T> = T Function(Parameters json)
ProgressCallback = void Function(int count, int total)
The type of a progress listening callback when sending or receiving data.
RebuildFactor = bool Function(MediaQueryData old, MediaQueryData 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.
ScreenUtilInitBuilder = Widget Function(BuildContext context, Widget? child)
ToJsonT<T> = Parameters? Function(T? value)
ValidateStatus = bool Function(int? status)
The type of a response status code validate callback.

Exceptions / Errors

APIError
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
DioException
DioException describes the exception info when a request failed.
DisallowedNullValueException
Exception thrown if there are keys with disallowed null values in a JSON map that was provided during deserialization.
MError
MissingRequiredKeysException
Exception thrown if there are missing required keys in a JSON map that was provided during deserialization.
NotNullableError<T>
A TypeError thrown by _checkNotNullable.
UnrecognizedKeysException
Exception thrown if there are unrecognized keys in a JSON map that was provided during deserialization.