ap_common_flutter_core library

Classes

AnalyticsConstants
AnalyticsUtil
Announcement
AnnouncementData
AnnouncementLoginData
ApConstants
ApIcon
ApiError<T>
ApiFailure<T>
ApiResult<T>
ApiSuccess<T>
ApLocalizations
AppLocaleUtils
Provides utility functions without any side effects.
AppStoreUtil
ApSupportLanguageConstants
BackgroundTransformer
The default Transformer for Dio.
BaseAppLocale<E extends BaseAppLocale<E, T>, T extends BaseTranslations<E, T>>
Similar to flutter locale but available without any flutter dependencies. Subclasses will be enums.
BaseAppLocaleUtils<E extends BaseAppLocale<E, T>, T extends BaseTranslations<E, T>>
Provides utility functions without any side effects.
BaseFlutterLocaleSettings<E extends BaseAppLocale<E, T>, T extends BaseTranslations<E, T>>
Similar to BaseLocaleSettings but actually implements the updateProviderState method.
BaseLocaleSettings<E extends BaseAppLocale<E, T>, T extends BaseTranslations<E, T>>
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.
BaseTranslationProvider<E extends BaseAppLocale<E, T>, T extends BaseTranslations<E, T>>
BaseTranslations<E extends BaseAppLocale<E, T>, T extends BaseTranslations<E, T>>
Root translation class of ONE locale Entry point for every translation
Bidi
This provides utility methods for working with bidirectional text. All of the methods are static, and are organized into a class primarily to group them together for documentation and discoverability.
BidiFormatter
Bidi stands for Bi-directional text. According to Wikipedia: Bi-directional text is text containing text in both text directionalities, both right-to-left (RTL) and left-to-right (LTR). It generally involves text containing different types of alphabets, but may also refer to boustrophedon, which is changing text directionality in each row.
CancelToken
Controls cancellation of Dio's requests.
Course
CourseData
CourseNotify
CourseNotifyData
CrashlyticsUtil
CrossFileTestOverrides
Overrides some functions of CrossFile for testing purposes
Data
DataEmpty<T>
Data loaded successfully but was empty.
DataError<T>
An error occurred while loading data.
DataLoaded<T>
Data was loaded successfully.
DataLoading<T>
Data is currently being loaded.
DataState<T>
A sealed class representing the state of asynchronous data loading.
DateFormat
DateFormat is for formatting and parsing dates in a locale-sensitive manner.
Detail
Dio
Dio enables you to make HTTP requests easily.
DioMixin
ErrorInterceptorHandler
The handler for interceptors to handle error occurred during the request.
FakeAppLocale
FakeTranslations
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
GeneralResponse
Headers
The headers class for requests and responses.
HttpClientAdapter
HttpAdapter is a bridge between Dio and HttpClient.
ImgurUploadData
ImgurUploadResponse
Info
InheritedLocaleData<E extends BaseAppLocale<E, T>, T extends BaseTranslations<E, T>>
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.
Intl
The Intl class provides a common entry point for internationalization related tasks. An Intl instance can be created for a particular locale and used to create a date format via anIntl.date(). Static methods on this class are also used in message formatting.
ListParam<T>
Indicates a param being used as queries or form data, and how does it gets formatted.
LocaleSettings
Manages all translation instances and the current locale
Location
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.
MediaUtil
MicroMoney
Used primarily for currency formatting, this number-like class stores millionths of a currency unit, typically as an Int64.
MultipartFile
An upload content that is a part of MultipartRequest. This doesn't need to correspond to a physical file.
Notifications
NotificationsData
NotificationUtil
NumberFormat
Provides the ability to format a number in a locale-specific way.
NumberParserBase<R>
Options
The configuration for a single request. BaseOptions and Options will be merged into one RequestOptions before sending the requests. See Options.compose.
PhoneModel
PlatformCalendarUtil
PlatformUtil
PluralResolvers
Default plural resolvers
PreferenceUtil
PrivateCookieManager
Don't use this class in Browser environment
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.
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.
RichPluralResolvers
Rich plural resolvers
SaveImageError
SaveImageResult
SaveImageSuccess
Score
ScoreData
SectionTime
Semester
SemesterData
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.
TextDirection
Represents directionality of text.
TimeCode
TimeCodeConfig
Transformer
Transformer allows changes to the request/response data before it is sent/received to/from the server.
TranslationMetadata<E extends BaseAppLocale<E, T>, T extends BaseTranslations<E, T>>
Metadata instance hold by the root translation class.
TranslationOverridesFlutter
TranslationProvider
Method B: Advanced
UiUtil
UserInfo
VersionInfo
XFile
A CrossFile is a cross-platform, simplified File abstraction.

Enums

AppLocale
Supported locales.
ApSupportLanguage
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.
GeneralPermissionStatus
ListFormat
Specifies the array format (a single parameter with multiple parameter or multiple parameters with the same name). and the separator for array items.
PermissionLevel
ResponseType
Indicates which transformation should be applied to the response data.

Mixins

OptionsMixin
The mixin class for options that provides common attributes.

Extensions

AnnouncementDataPatterns on AnnouncementData
Adds pattern-matching-related methods to AnnouncementData.
AnnouncementLoginDataPatterns on AnnouncementLoginData
Adds pattern-matching-related methods to AnnouncementLoginData.
AnnouncementPatterns on Announcement
Adds pattern-matching-related methods to Announcement.
ApExtension on ApLocalizations
ApiResultErrorHandler on ApiResult<T>
AppLocaleUtilsExt on BaseAppLocaleUtils<E, T>
ApSupportLanguageExtension on ApSupportLanguage
BuildContextTranslationsExtension on BuildContext
Method B shorthand via BuildContext extension method. Configurable via 'translate_var'.
CourseDataPatterns on CourseData
Adds pattern-matching-related methods to CourseData.
CourseNotifyDataPatterns on CourseNotifyData
Adds pattern-matching-related methods to CourseNotifyData.
CourseNotifyPatterns on CourseNotify
Adds pattern-matching-related methods to CourseNotify.
CoursePatterns on Course
Adds pattern-matching-related methods to Course.
DataPatterns on Data
Adds pattern-matching-related methods to Data.
DetailPatterns on Detail
Adds pattern-matching-related methods to Detail.
DioExceptionI18nExtension on DioException
ExtAppLocale on BaseAppLocale<BaseAppLocale, BaseTranslations>
ExtAppLocaleUtils on BaseAppLocaleUtils<E, T>
ExtBaseLocaleSettings on BaseFlutterLocaleSettings<E, T>
GeneralResponsePatterns on GeneralResponse
Adds pattern-matching-related methods to GeneralResponse.
ImgurUploadDataPatterns on ImgurUploadData
Adds pattern-matching-related methods to ImgurUploadData.
ImgurUploadResponsePatterns on ImgurUploadResponse
Adds pattern-matching-related methods to ImgurUploadResponse.
InfoPatterns on Info
Adds pattern-matching-related methods to Info.
LocaleSettingsExt on BaseLocaleSettings<E, T>
LocationPatterns on Location
Adds pattern-matching-related methods to Location.
NotificationsDataPatterns on NotificationsData
Adds pattern-matching-related methods to NotificationsData.
NotificationsPatterns on Notifications
Adds pattern-matching-related methods to Notifications.
PhoneModelPatterns on PhoneModel
Adds pattern-matching-related methods to PhoneModel.
ScoreDataPatterns on ScoreData
Adds pattern-matching-related methods to ScoreData.
ScorePatterns on Score
Adds pattern-matching-related methods to Score.
SectionTimePatterns on SectionTime
Adds pattern-matching-related methods to SectionTime.
SemesterDataPatterns on SemesterData
Adds pattern-matching-related methods to SemesterData.
SemesterPatterns on Semester
Adds pattern-matching-related methods to Semester.
TimeCodeConfigPatterns on TimeCodeConfig
Adds pattern-matching-related methods to TimeCodeConfig.
TimeCodeExtension on List<TimeCode>
TimeCodePatterns on TimeCode
Adds pattern-matching-related methods to TimeCode.
UserInfoPatterns on UserInfo
Adds pattern-matching-related methods to UserInfo.
VersionInfoPatterns on VersionInfo
Adds pattern-matching-related methods to VersionInfo.

Properties

ap ApLocalizations
Method A: Simple
no setter

Functions

defaultDioExceptionReadableStringBuilder(DioException e) String
The default implementation of building a readable string of DioException.
registerApCommonCore({required PreferenceUtil preference}) → void
registerApCommonFlutter({required UiUtil ui, required PlatformUtil platform, required MediaUtil media, required PlatformCalendarUtil platformCalendar, required NotificationUtil notification, required AppStoreUtil appStore}) → void
registerApCommonService({AnalyticsUtil analytics = const MockAnalyticsUtil(), CrashlyticsUtil crashlytics = const MockCrashlyticsUtil()}) → void
setApLocale(AppLocale locale) Future<AppLocale>
Helper to set locale for both slang and Intl (DateFormat). Call this from your app when changing locale.
setApLocaleFromFlutter(Locale locale) Future<AppLocale>
Helper to set locale from a Flutter Locale.
toBeginningOfSentenceCase<T extends String?>(T input, [String? locale]) → T
Convert a string to beginning of sentence case, in a way appropriate to the locale.
useApDeviceLocale() Future<AppLocale>
Helper to use device locale for both slang and Intl (DateFormat).

Typedefs

ApLocalizationsEn = ApLocalizations
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.
InlineSpanBuilder = InlineSpan Function(String)
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.
PluralResolver = String Function(num n, {String? few, String? many, String? one, String? other, String? two, String? zero})
Selects the correct string depending on n
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.
ValidateStatus = bool Function(int? status)
The type of a response status code validate callback.

Exceptions / Errors

DioException
DioException describes the exception info when a request failed.
NotNullableError<T>
A TypeError thrown by _checkNotNullable.