utils/export library

Classes

AdaptUtil
Bindings
Bindings should be extended or implemented. When using GetMaterialApp, all GetPages and navigation methods (like Get.to()) have a binding property that takes an instance of Bindings to manage the dependencies() (via Get.put()) for the Route you are opening.
BindingsBuilder<T>
Simplifies Bindings generation from a single callback. To avoid the creation of a custom Binding instance per route.
Config
CustomTransition
DisposableInterface
EasyLogConsoleController
EasyLogConsolePage
FastList<T>
FormData
FullLifeCycleController
GetBar
GetBuilder<T extends GetxController>
GetBuilderState<T extends GetxController>
GetConnect
GetConnectInterface
GetCupertinoApp
GetDelegate
GetHttpClient
GetInformationParser
GetInstance
GetInterface
GetInterface allows any auxiliary package to be merged into the "Get" class through extensions
GetLifeCycle
GetMaterialApp
GetMaterialController
GetMicrotask
GetMiddleware
The Page Middlewares. The Functions will be called in this order (( redirect -> onPageCalled -> onBindingsStart -> onPageBuildStart -> onPageBuilt -> onPageDispose ))
GetModalBottomSheetRoute<T>
GetNavConfig
This config enables us to navigate directly to a sub-url
GetNavigator
GetNotifier<T>
GetObserver
GetPage<T>
GetPageRoute<T>
GetPlatform
GetQueue
GetResponsiveView<T>
Extend this widget to build responsive view. this widget contains the screen property that have all information about the screen size and type. You have two options to build it. 1- with builder method you return the widget to build. 2- with methods desktop, tablet,phone, watch. the specific method will be built when the screen type matches the method when the screen is ScreenType.Tablet the tablet method will be exuded and so on. Note if you use this method please set the property alwaysUseBuilder to false With settings property you can set the width limit for the screen types.
GetResponsiveWidget<T extends GetLifeCycleBase?>
GetRouterOutlet
GetSnackBar
GetSnackBarState
GetSocket
GetStream<T>
GetStream is the lightest and most performative way of working with events at Dart. You sintaxe is like StreamController, but it works with simple callbacks. In this way, every event calls only one function. There is no buffering, to very low memory consumption. event add will add a object to stream. addError will add a error to stream. listen is a very light StreamSubscription interface. Is possible take the last value with value property.
GetStreamTransformation<T>
GetUtils
GetView<T>
GetView is a great way of quickly access your Controller without having to call Get.find
GetWidget<S extends GetLifeCycleBase?>
GetWidget is a great way of quickly access your individual Controller without having to call Get.find
GetX<T extends DisposableInterface>
GetxController
GetxService
Unlike GetxController, which serves to control events on each of its pages, GetxService is not automatically disposed (nor can be removed with Get.delete()). It is ideal for situations where, once started, that service will remain in memory, such as Auth control for example. Only way to remove it is Get.reset().
GetXState<T extends DisposableInterface>
GraphQLResponse<T>
HeaderValue
InstanceInfo
InternalFinalCallback<T>
Special callable class to keep the contract of a regular method, and avoid overrides if you extend the class that uses it, as Dart has no final methods. Used in DisposableInterface to avoid the danger of overriding onStart.
LightSubscription<T>
MiddlewareRunner
MiniStream<T>
MiniSubscription<T>
MixinBuilder<T extends GetxController>
MultipartFile
NetworkUtil
Node<T>
Obx
The simplest reactive widget in GetX.
ObxState
ObxValue<T extends RxInterface>
Similar to Obx, but manages a local state. Pass the initial data in constructor. Useful for simple local states, like toggles, visibility, themes, button states, etc. Sample: ObxValue((data) => Switch( value: data.value, onChanged: (flag) => data.value = flag, ), false.obs, ),
ObxWidget
The ObxWidget is the base for all GetX reactive widgets
PackageInfoUtil
PageRedirect
PathDecoded
Response<T>
ResponsiveScreen
ResponsiveScreenSettings
Result
A Result.
RouterOutlet<TDelegate extends RouterDelegate<T>, T extends Object>
RouterOutletState<TDelegate extends RouterDelegate<T>, T extends Object>
Routing
Rx<T>
Foundation class used for custom Types outside the common native Dart types. For example, any custom "Model" class, like User().obs will use Rx as wrapper.
RxBool
RxController
RxDouble
RxInt
RxInterface<T>
This class is the foundation for all reactive (Rx) classes that makes Get so powerful. This interface is the contract that _RxImpl]
RxList<E>
Create a list similar to List<T>
RxMap<K, V>
Rxn<T>
RxnBool
RxnDouble
RxnInt
RxnNum
RxNotifier<T>
RxnString
Rx class for String Type.
RxNum
RxSet<E>
RxStatus
RxString
Rx class for String Type.
Session
SharedPreferencesUtil
SimpleBuilder
SimpleBuilderState
SnackbarController
StorageUtil
SuperController<T>
TimerUtil
Translations
TrustedCertificate
Value<T>
ValueBuilder<T>
Manages a local state like ObxValue, but uses a callback instead of a Rx value.
ValueBuilderState<T>
Worker
Workers

Enums

BaseURLType
URL环境
ErrorType
PopMode
Enables the user to customize the intended pop behavior
PreventDuplicateHandlingMode
Enables the user to customize the behavior when pushing multiple routes that shouldn't be duplicates
RowStyle
ScreenType
SmartManagement
GetX by default disposes unused controllers from memory, Through different behaviors. SmartManagement.full SmartManagement.full is the default one. Dispose classes that are not being used and were not set to be permanent. In the majority of the cases you will want to keep this config untouched. If you new to GetX then don't change this. SmartManagement.onlyBuilder only controllers started in init: or loaded into a Binding with Get.lazyPut() will be disposed. If you use Get.put() or Get.putAsync() or any other approach, SmartManagement will not have permissions to exclude this dependency. With the default behavior, even widgets instantiated with "Get.put" will be removed, unlike SmartManagement.onlyBuilders. SmartManagement.keepFactoryJust like SmartManagement.full, it will remove it's dependencies when it's not being used anymore. However, it will keep their factory, which means it will recreate the dependency if you need that instance again.
SnackbarStatus
Indicates Status of snackbar SnackbarStatus.OPEN Snack is fully open, SnackbarStatus.CLOSED Snackbar has closed, SnackbarStatus.OPENING Starts with the opening animation and ends with the full snackbar display, SnackbarStatus.CLOSING Starts with the closing animation and ends with the full snackbar dispose
SnackPosition
Indicates if snack is going to start at the TOP or at the BOTTOM
SnackStyle
Indicates if snack will be attached to the edge of the screen or not
Transition

Mixins

FullLifeCycleMixin
GetLifeCycleBase
The GetLifeCycle
GetResponsiveMixin
GetSingleTickerProviderStateMixin
Used like SingleTickerProviderMixin but only with Get Controllers. Simplifies AnimationController creation inside GetxController.
GetStateUpdaterMixin<T extends StatefulWidget>
Complies with GetStateUpdater
GetTickerProviderStateMixin
Used like TickerProviderMixin but only with Get Controllers. Simplifies multiple AnimationController creation inside GetxController.
GetxServiceMixin
Allow track difference between GetxServices and GetxControllers
NotifyManager<T>
PageRouteReportMixin<T>
RxObjectMixin<T>
global object that registers against GetX and Obx, and allows the reactivity of those Widgets and Rx values.
ScrollMixin
SingleGetTickerProviderMixin
Used like SingleTickerProviderMixin but only with Get Controllers. Simplifies AnimationController creation inside GetxController.
StateMixin<T>

Constants

colorWithHex3 → const Color
colorWithHex4 → const Color
colorWithHex5 → const Color
colorWithHex6 → const Color
colorWithHex7 → const Color
colorWithHex8 → const Color
colorWithHex9 → const Color
colorWithHexA → const Color
colorWithHexB → const Color
colorWithHexC → const Color
colorWithHexD → const Color
colorWithHexE → const Color
isProduction → const bool
kPathIcons → const String
kPathOthers → const String
rtlLanguages → const List<String>

Properties

appBuildNumber String
The app build number. CFBundleVersion on iOS, versionCode on Android.
final
appDeviceLocale Locale?
ui.window.locale
final
appLocale Locale?
The app Current locale
no setter
appName String
The app name. CFBundleDisplayName on iOS, application/label on Android.
final
appPackageName String
The app package name. bundleIdentifier on iOS, getPackageName on Android.
final
appVersion String
The app package version. CFBundleShortVersionString on iOS, versionName on Android.
final
baseURLChangedCallback VoidCallback?
BaseURL变化回调
getter/setter pair
colorWithDivider Color
getter/setter pair
Get → _GetImpl
final
isAndroid bool
getter/setter pair
isAppDebugFlag bool
打开app调试模式
getter/setter pair
isDebug bool
final
isIOS bool
getter/setter pair
isIPhoneX bool
getter/setter pair
isMacOS bool
getter/setter pair
isPhone bool
getter/setter pair
isWeb bool
getter/setter pair
isWebInAndroid bool
no setter
isWebInIos bool
no setter
isWebInIPad bool
no setter
isWebInIPhone bool
no setter
isWebInWeChat bool
no setter
isWindows bool
getter/setter pair
kBaseURLType BaseURLType
上线环境
no setter
kEmptyList String
列表无数据
getter/setter pair
kFirstPage int
分页时第一页的起始页值
getter/setter pair
kLimitPage int
分页时每页数量
getter/setter pair
kPageKey String
页码数
getter/setter pair
kPageSizeKey String
每页数量
getter/setter pair
kReleaseBaseURL String
生产环境
getter/setter pair
kTestBaseURL String
测试环境
getter/setter pair
It replaces the Flutter Navigator, but needs no context. You can to use navigator.push(YourRoute()) rather Navigator.push(context, YourRoute());
no setter
screenBottomBarHeightDp double
底部安全区距离 dp
getter/setter pair
screenDevicePixelRatio double
The number of device pixels for each logical pixe
getter/setter pair
screenHeightDp double
当前设备高度 dp
getter/setter pair
screenStatusBarHeightDp double
状态栏高度 dp 刘海屏会更高
getter/setter pair
screenToolbarHeightDp double
导航栏高度 dp
getter/setter pair
screenWidthDp double
当前设备宽度 dp
getter/setter pair
setDarkAppBarBackgroundColor Color
getter/setter pair
setDarkAppBarForegroundColor Color
getter/setter pair
setDarkBodyText2Style TextStyle
getter/setter pair
setDarkPlaceholderTextFieldStyle TextStyle
getter/setter pair
setDarkPrimaryColor MaterialColor
getter/setter pair
setDarkPrimarySwatchColor Color
getter/setter pair
setDarkScaffoldBackgroundColor Color
getter/setter pair
setDarkTextFieldStyle TextStyle
getter/setter pair
setLightAppBarBackgroundColor Color
getter/setter pair
setLightAppBarForegroundColor Color
getter/setter pair
setLightBodyText2Style TextStyle
getter/setter pair
setLightPlaceholderTextFieldStyle TextStyle
getter/setter pair
setLightPrimaryColor MaterialColor
getter/setter pair
setLightPrimarySwatchColor Color
getter/setter pair
setLightScaffoldBackgroundColor Color
getter/setter pair
setLightTextFieldStyle TextStyle
getter/setter pair
userAgent String
no setter
webOrigin String
no setter
webUserAgent String
https://www.jianshu.com/p/40430596e3ab
no setter

Functions

adaptDp(dynamic number) → dynamic
根据设计稿的比例适配dp保证不变形
adaptOnePx() → dynamic
根据设备适配1px像素大小
adaptPx(dynamic number) → dynamic
根据设计稿的比例适配像素保证不变形
ambiguate<T>(T? value) → T?
appDarkMode(BuildContext context) bool
appStoreUrl(String appId) String
appStoreUserReviewsUrl(String appId) String
appStoreWriteReview(String name, String appId) String
appTheme(BuildContext context) ThemeData
appUpdateLocale(Locale l) → void
assetsImagesPath(String name, {String format = "png"}) String
获取图片路径
assetsImagesPathSvg(String name) String
获取图片路径后缀svg
assetsImagesPathWebP(String name) String
获取图片路径后缀wep
base64Decode(String encoded) Uint8List?
base64解密字符串
base64DecodeString(String data) String
base64解密字符串
base64Encode(List<int> input) String
base64加密二进制
base64EncodeString(String data) String
base64加密字符串
bodyBytesToString(Stream<List<int>> bodyBytes, Map<String, String> headers) Future<String>
calcTemporaryDirectoryCacheSize() Future<String>
canLaunch(String urlString) Future<bool>
clearStorage() Future<bool>
clearTemporaryDirectoryCache() Future<bool>
colorWithRandom() Color
debounce<T>(RxInterface<T> listener, WorkerCallback<T> callback, {Duration? time, Function? onError, void onDone()?, bool? cancelOnError}) Worker
debounce is similar to interval, but sends the last value. Useful for Anti DDos, every time the user stops typing for 1 second, for instance. When listener emits the last "value", when time hits, it calls callback with the last "value" emitted.
defaultLogWriterCallback(String value, {bool isError = false}) → void
default logger from GetX
dismissLoading() → void
ever<T>(RxInterface<T> listener, WorkerCallback<T> callback, {dynamic condition = true, Function? onError, void onDone()?, bool? cancelOnError}) Worker
Called every time listener changes. As long as the condition returns true.
everAll(List<RxInterface> listeners, WorkerCallback callback, {dynamic condition = true, Function? onError, void onDone()?, bool? cancelOnError}) Worker
Similar to ever, but takes a list of listeners, the condition for the callback is common to all listeners, and the callback is executed to each one of them. The Worker is common to all, so worker.dispose() will cancel all streams.
formatDigitNum(Object num, {int digit = 3}) String
每隔n位 加逗号
formatDigitPattern(String text, {int digit = 4, String pattern = ' '}) String
每隔n位 加 pattern
formatDigitPatternEnd(String text, {int digit = 4, String pattern = ' '}) String
每隔n位 加 pattern, 从末尾开始
formatFractionDigitsAsFixed(double amount, {int fractionDigits = 2, bool autoClearZero = false}) String
保留n位小数
get({String? baseUrl, String path = '', Map<String, dynamic>? queryParameters, int? connectTimeout, bool validResult = true, bool autoLoading = false}) Future<Result>
发送请求并解析远程服务器返回的result对应的实体类型
getClipboard() Future<String?>
获取剪贴板内容
getStorageBool(String key) Future<bool>
getStorageString(String key) Future<String?>
getTheme({bool darkMode = false}) ThemeData
getUuidV1() → dynamic
基于时间戳实现
getUuidV4() → dynamic
基于随机算法实现
hideKeyboard(BuildContext context) → void
全局隐藏键盘
initSelectedBaseURLType() Future<String?>
interval<T>(RxInterface<T> listener, WorkerCallback<T> callback, {Duration time = const Duration(seconds: 1), dynamic condition = true, Function? onError, void onDone()?, bool? cancelOnError}) Worker
Ignore all changes in listener during time (1 sec by default) or until condition is met (can be a bool expression or a bool Function()), It brings the 1st "value" since the period of time, so if you click a counter button 3 times in 1 sec, it will show you "1" (after 1 sec of the first press) click counter 3 times in 1 sec, it will show you "4" (after 1 sec) click counter 2 times in 1 sec, it will show you "7" (after 1 sec).
jsonDecode(String source, {Object? reviver(Object? key, Object? value)?}) → dynamic
Parses the string and returns the resulting Json object.
jsonEncode(Object? value, {Object? toEncodable(dynamic object)?}) String
Converts value to a JSON string.
logDebug(dynamic message) → void
logError(dynamic message) → void
logInfo(dynamic message) → void
logRequest(RequestOptions options) → void
logResponse(Result result) → void
logWarning(dynamic message) → void
logWTF(dynamic message) → void
lunarSolarConverter(DateTime date) Lunar
公历转农历
once<T>(RxInterface<T> listener, WorkerCallback<T> callback, {dynamic condition = true, Function? onError, void onDone()?, bool? cancelOnError}) Worker
once() will execute only 1 time when condition is met and cancel the subscription to the listener stream right after that. condition defines when callback is called, and can be a bool or a bool Function().
onLaunch(String urlString, {bool forceSafariVC = false, bool forceWebView = false, bool enableJavaScript = false, bool enableDomStorage = false, bool universalLinksOnly = false, Map<String, String> headers = const <String, String>{}, Brightness? statusBarBrightness}) Future<bool>
post({String? baseUrl, String path = '', dynamic data, int? connectTimeout, bool validResult = true, bool autoLoading = false}) Future<Result>
发送请求并解析远程服务器返回的result对应的实体类型
randomInt(int max) int
随机数(0-max)小于max
removeStorage(String key) Future<bool>
request({String? baseUrl, String path = '', dynamic data, Map<String, dynamic>? queryParameters, Options? options, int? connectTimeout, bool validResult = true, bool autoLoading = false}) Future<Result>
发送请求并解析远程服务器返回的result对应的实体类型
reverse(String text) String
反转字符串
setClipboard(String text) Future<void>
将文本内容复制到剪贴板
setStorageBool(String key, bool value) Future<bool>
setStorageString(String key, String value) Future<bool>
showErrorToast(String status, {Duration? duration, EasyLoadingMaskType? maskType, bool? dismissOnTap}) → void
showInfoToast(String status, {Duration? duration, EasyLoadingMaskType? maskType, bool? dismissOnTap}) → void
showLoading({String? status, Widget? indicator, EasyLoadingMaskType? maskType, bool? dismissOnTap}) → void
showModalPopupDatePicker(BuildContext context, {double? height, CupertinoDatePickerMode mode = CupertinoDatePickerMode.dateAndTime, DateTime? initialDateTime, DateTime? minimumDate, DateTime? maximumDate, int? minimumYear, int? maximumYear}) Future<DateTime?>
showModalPopupTitlesPicker(BuildContext context, List<String> titles, {double? height}) Future<int?>
showProgress(double value, {String? status, EasyLoadingMaskType? maskType}) → void
showSelectBaseURLTypeAlert({BuildContext? context}) Future<bool?>
弹出切换环境菜单
showSuccessToast(String status, {Duration? duration, EasyLoadingMaskType? maskType, bool? dismissOnTap}) → void
showToast(String status, {Duration? duration, EasyLoadingToastPosition? toastPosition, EasyLoadingMaskType? maskType, bool? dismissOnTap}) → void
sortMap(Map map) Map
timestampBy(DateTime dateTime) int
获取指定时间戳
timestampNow() int
获取当前时间戳
timestampTo_HH_mm(int timestamp, {String unit = ':', bool isUtc = false}) String
时间戳转HH:mm
timestampToDateTime(int timestamp, {bool isUtc = false}) DateTime
时间戳转DateTime
timestampToNormal_yyyy_MM_dd(int timestamp, {bool isUtc = false}) String
时间戳转yyyy-MM-dd
timestampToNormal_yyyy_MM_dd_HH_mm_ss(int timestamp, {bool isUtc = false}) String
时间戳转yyyy-MM-dd HH:mm:ss
timestampToZh_yyyy_MM(int timestamp, {bool isUtc = false}) String
时间戳转yyyy年MM月
timestampToZh_yyyy_MM_dd(int timestamp, {bool isUtc = false}) String
时间戳转yyyy年MM月dd日
timestampToZh_yyyy_MM_dd_HH_mm(int timestamp, {bool isUtc = false}) String
时间戳转yyyy年MM月dd日 HH时mm分
timestampToZh_yyyy_MM_dd_HH_mm_ss(int timestamp, {bool isUtc = false}) String
时间戳转yyyy年MM月dd日 HH时mm分ss秒
twelveConstellationBy(DateTime dateTime) BaseKeyValue
标志 星座 拉丁名称 出生日期(公历) 别名 ♈ 白羊座 Aries 3月21日~4月19日 牡羊座 ♉ 金牛座 Taurus 4月20日~5月20日 金牛座 ♊ 双子座 Gemini 5月21日~6月21日 双子座 ♋ 巨蟹座 Cancer 6月22日~7月22日 巨蟹座 ♌ 狮子座 Leo 7月23日~8月22日 狮子座 ♍ 处女座 Virgo 8月23日~9月22日 室女座 ♎ 天秤座 Libra 9月23日~10月23日 天平座 ♏ 天蝎座 Scorpio 10月24日~11月22日 天蝎座 ♐ 射手座 Sagittarius 11月23日~12月21日 人马座 ♑ 摩羯座 Capricorn 12月22日~1月19日 山羊座 ♒ 水瓶座 Aquarius 1月20日~2月18日 宝瓶座 ♓ 双鱼座 Pisces 2月19日~3月20日 双鱼座 "${(constellation.extend as List
twelveConstellationNow() BaseKeyValue
twoDigits(int n) String
不足两位前面补0

Typedefs

AddSubscription<T> = FutureOr<void> Function(LightSubscription<T> subs)
AsyncInstanceBuilderCallback<S> = Future<S> Function()
BindingBuilderCallback = void Function()
Condition = bool Function()
Decoder<T> = T Function(dynamic data)
GetControllerBuilder<T extends DisposableInterface> = Widget Function(T controller)
GetPageBuilder = Widget Function()
GetXControllerBuilder<T extends DisposableInterface> = Widget Function(T controller)
InjectorBuilderCallback<S> = S Function(GetInstance)
InstanceBuilderCallback<S> = S Function()
LogWriterCallback = void Function(String text, {bool isError})
VoidCallback from logs
NotifierBuilder<T> = Widget Function(T state)
OnTap = void Function(GetSnackBar snack)
PrintFunctionCallback = void Function(String prefix, dynamic value, String info, {bool? isError})
Progress = dynamic Function(double percent)
RemoveSubscription<T> = FutureOr<bool?> Function(LightSubscription<T> subs)
SessionInterceptorSendHandler = dynamic Function(RequestOptions options)
SessionInterceptorSuccessHandler = dynamic Function(Result result)
SnackbarStatusCallback = void Function(SnackbarStatus? status)
ValueBuilderBuilder<T> = Widget Function(T snapshot, ValueBuilderUpdateCallback<T> updater)
ValueBuilderUpdateCallback<T> = void Function(T snapshot)
ValueUpdater<T> = T Function()
WidgetCallback = Widget Function()
WorkerCallback<T> = dynamic Function(T callback)