flutter_ahlib_util
library
Classes
-
ActionController
-
A controller which is used to store and invoke action callbacks. This controller can be used to implement
point-to-point communication across widgets. If you want to use publish/subscribe pattern, or said event bus,
please use https://pub.dev/packages/event_bus.
-
DownloadOption
-
A data class for downloadFile, which is used to describe some downloading options.
-
Err<T extends Object, E extends Object>
-
A type that represent a err TaskResult.
-
ExtendedLogger
-
This
Logger
is extended from https://github.com/leisim/logger, which contains some
new instance method, such as changePrinter and addOutputListener.
-
Ok<T extends Object, E extends Object>
-
A type that represent a ok TaskResult.
-
PreferredPrinter
-
This is an implementation of
LogPrinter
, which is preferred by AoiHosizora :)
-
TaskResult<T extends Object, E extends Object>
-
A type that represents either ok/success or err/failure result, and is referred from
rust's
std::Result
enum.
-
Tuple1<T>
-
Represents a 1-tuple, which can be used to wrap simple type as referable type.
-
Tuple2<T1, T2>
-
Represents a 2-tuple, or pair.
-
Tuple3<T1, T2, T3>
-
Represents a 3-tuple, or triple.
-
Tuple4<T1, T2, T3, T4>
-
Represents a 4-tuple, or quadruple.
-
Tuple5<T1, T2, T3, T4, T5>
-
Represents a 5-tuple, or quintuple.
-
Tuple6<T1, T2, T3, T4, T5, T6>
-
Represents a 6-tuple, or sextuple.
Constants
-
kAlertDialogDefaultButtonPadding
→ const EdgeInsets
-
Defined in src/material/dialog.dart, used by AlertDialog.
-
kAlertDialogDefaultContentPadding
→ const EdgeInsets
-
Defined in src/material/dialog.dart, used by AlertDialog.
-
kAlertDialogDefaultTitlePadding
→ const EdgeInsets
-
Defined in src/material/dialog.dart, used by AlertDialog.
-
kAppBarDefaultElevation
→ const double
-
Defined in src/material/app_bar.dart, used by AppBar.
-
kAppBarDefaultShadowColor
→ const Color
-
Defined in src/material/app_bar.dart, used by AppBar.
-
kAppBarLeadingWidth
→ const double
-
Defined in src/material/app_bar.dart, used by AppBar.
-
kBottomAppBarDefaultElevation
→ const double
-
Defined in src/material/bottom_app_bar.dart, used by BottomAppBar.
-
kBottomSheetEnterDuration
→ const Duration
-
Defined in src/material/bottom_sheet.dart, used by BottomSheet.
-
kBottomSheetExitDuration
→ const Duration
-
Defined in src/material/bottom_sheet.dart, used by BottomSheet.
-
kCardDefaultElevation
→ const double
-
Defined in src/material/card.dart, used by Card.
-
kCupertinoTransitionDuration
→ const Duration
-
Defined in src/cupertino/route.dart, used by CupertinoRouteTransitionMixin.
-
kDialogDefaultElevation
→ const double
-
Defined in src/material/dialog.dart, used by Dialog.
-
kDialogDefaultInsetPadding
→ const EdgeInsets
-
Defined in src/material/dialog.dart, used by Dialog.
-
kDividerDefaultHeight
→ const double
-
Defined in src/material/divider.dart, used by Divider.
-
kDrawerBaseSettleDuration
→ const Duration
-
Defined in src/material/drawer.dart, used by Drawer.
-
kDrawerEdgeDragWidth
→ const double
-
Defined in src/material/drawer.dart, used by Drawer.
-
Defined in src/material/drawer_header.dart, used by DrawerHeader.
-
Defined in src/material/drawer_header.dart, used by DrawerHeader.
-
kDrawerWidth
→ const double
-
Defined in src/material/drawer.dart, used by Drawer.
-
Defined in src/material/dropdown.dart, used by DropdownButton.
-
Defined in src/material/dropdown.dart, used by DropdownButton.
-
kExpansionPanelExpandDuration
→ const Duration
-
Defined in src/material/expansion_panel.dart, used by ExpansionPanel.
-
Defined in src/material/expansion_panel.dart, used by ExpansionPanel.
-
kInputDecorationTransitionDuration
→ const Duration
-
Defined in src/material/input_decoration.dart, used by InputDecoration.
-
kMaterialBannerTransitionDuration
→ const Duration
-
Defined in src/material/banner.dart, used by MaterialBanner.
-
kMaterialDialogTransitionDuration
→ const Duration
-
Defined in src/material/dialog.dart, used by Dialog.
-
kMaterialTransitionDuration
→ const Duration
-
Defined in src/material/page.dart, used by MaterialRouteTransitionMixin.
-
Defined in src/material/popup_menu.dart, used by PopupMenuButton.
-
kScrollbarFadeDuration
→ const Duration
-
Defined in src/material/srollbar.dart, used by Scrollbar.
-
kScrollbarTimeToFade
→ const Duration
-
Defined in src/material/srollbar.dart, used by Scrollbar.
-
kSimpleDialogDefaultContentPadding
→ const EdgeInsets
-
Defined in src/material/dialog.dart, used by SimpleDialog.
-
kSimpleDialogDefaultOptionPadding
→ const EdgeInsets
-
Defined in src/material/dialog.dart, used by SimpleDialog.
-
kSimpleDialogDefaultTitlePadding
→ const EdgeInsets
-
Defined in src/material/dialog.dart, used by SimpleDialog.
-
kSnackBarDisplayDuration
→ const Duration
-
Defined in src/material/snack_bar.dart, used by SnackBar.
-
kSnackBarTransitionDuration
→ const Duration
-
Defined in src/material/snack_bar.dart, used by SnackBar.
-
kSwitchHeight
→ const double
-
Defined in src/material/switch.dart, used by Switch.
-
kSwitchHeightCollapsed
→ const double
-
Defined in src/material/switch.dart, used by Switch.
-
kSwitchThumbRadius
→ const double
-
Defined in src/material/switch.dart, used by Switch.
-
kSwitchTrackHeight
→ const double
-
Defined in src/material/switch.dart, used by Switch.
-
kSwitchTrackWidth
→ const double
-
Defined in src/material/switch.dart, used by Switch.
-
kSwitchWidth
→ const double
-
Defined in src/material/switch.dart, used by Switch.
-
kTabDefaultIndicatorWeight
→ const double
-
Defined in src/material/tabs.dart, used by TabBar.
-
kTabHeight
→ const double
-
Defined in src/material/tabs.dart, used by TabBar.
-
kTextAndIconTabHeight
→ const double
-
Defined in src/material/tabs.dart, used by TabBar.
-
kTextSelectionHandleSize
→ const double
-
Defined in src/material/text_selection.dart, used by TextSelection.
-
kTextSelectionToolbarContentDistance
→ const double
-
Defined in src/material/text_selection.dart, used by TextSelection.
-
kTextSelectionToolbarContentDistanceBelow
→ const double
-
Defined in src/material/text_selection.dart, used by TextSelection.
-
kTextSelectionToolbarHeight
→ const double
-
Defined in src/material/text_selection_toolbar.dart, used by TextSelectionToolbar.
-
kTextSelectionToolbarScreenPadding
→ const double
-
Defined in src/material/text_selection_toolbar.dart, used by TextSelectionToolbar.
-
kTooltipDefaultShowDuration
→ const Duration
-
Defined in src/material/tooltip.dart, used by Tooltip.
-
kTooltipDefaultVerticalOffset
→ const double
-
Defined in src/material/tooltip.dart, used by Tooltip.
-
kTooltipFadeInDuration
→ const Duration
-
Defined in src/material/tooltip.dart, used by Tooltip.
-
kTooltipFadeOutDuration
→ const Duration
-
Defined in src/material/tooltip.dart, used by Tooltip.
Functions
-
ansiEscapeCodeToPlainText(String s)
→ String
-
Parses given text which contains ANSI escape code to plain text.
-
callAll(List<void Function()> functions)
→ void
-
Calls given all functions, this function can be used to avoid introducing braces and makes code more compact.
-
downloadFile({required String url, required String filepath, BaseCacheManager? cacheManager, String? cacheKey, DownloadOption? option})
→ Future<File>
-
Downloads file from
url
with headers
and saves to filepath
. Here cacheManager
defaults to
DefaultCacheManager()
, and cacheKey
defaults to url
, and option
defines detailed downloading
option, such as downloading behaviors.
-
filesize(int bytes, [int round = 2, bool mustRound = false])
→ String
-
Returns a formatted string value (such as "2 MB" and "2.34 KB") of given byte size.
-
filesizeWithoutSpace(int bytes, [int round = 2, bool mustRound = false])
→ String
-
Returns a formatted string value (such as "2MB" and "2.34KB") of given byte size.
-
getExtensionsFromMime(String mime)
→ List<String>?
-
Gets extension list from given MIME type. Note that this function returns null if
given MIME type has no correspond extension.
-
getMimeFromExtension(String extension)
→ String?
-
Gets MIME type from given extension. Note that this function returns null if given
extension has no correspond MIME type.
-
getPreferredExtensionFromMime(String mime)
→ String?
-
Gets preferred extension from given MIME type. Here for example, "jpg" is preferred
in "jpg" and "jpeg", "html" is preferred in "htm" and "html". Note that this
function returns null if given MIME type has no correspond extension.
-
resultFromAsyncFunc<T extends Object, E extends Object>(FutureOr<T> func())
→ Future<TaskResult<T, E>>
-
Returns a result by executing given async function and catching current type of exception.
-
resultFromFunc<T extends Object, E extends Object>(T func())
→ TaskResult<T, E>
-
Returns a result by executing given function and catching current type of exception.