nb_utils library Null safety


Default App Button
Default Text Form Field
A circular progress indicator with gradient effect.
Discover network connectivity configurations: Distinguish between WI-FI and cellular, check WI-FI status and more.
Plugin to show a toast message on screen Only for android, ios and Web platforms
Runs on dart side this has no interaction with the Native Side Works with all platforms just in two lines of code final fToast = FToast().init(context) fToast.showToast(child)
Use SELECTED_LANGUAGE_CODE Pref key to get selected language code
CREDITS https://pub.dev/packages/livestream [...]
Circular Loader Widget
Marquee Text
set different layout based on current screen size (mobile, web, desktop)
Custom scroll behaviour widget
Wraps NSUserDefaults (on iOS) and SharedPreferences (on Android), providing a persistent store for simple data. [...]
State for _ToastStateFul
Add UL to its children


AfterLayoutMixin<T extends StatefulWidget>
Callback after build widget is rendered CREDIT https://pub.dev/packages/after_layout




aliceBlue → const Color
const Color(0xFFF0F8FF)
antiqueWhite → const Color
const Color(0xFFFAEBD7)
appStoreBaseURL → const String
aqua → const Color
const Color(0xFF00FFFF)
aquamarine → const Color
const Color(0xFF7FFFD4)
azure → const Color
const Color(0xFFF0FFFF)
beige → const Color
const Color(0xFFF5F5DC)
bisque → const Color
const Color(0xFFFFE4C4)
black → const Color
const Color(0xFF000000)
blackColor → const Color
blanchedAlmond → const Color
const Color(0xFFFFEBCD)
blueColor → const Color
const Color(0xFF0000FF)
blueViolet → const Color
const Color(0xFF8A2BE2)
brown → const Color
const Color(0xFFA52A2A)
burlyWood → const Color
const Color(0xFFDEB887)
cadetBlue → const Color
const Color(0xFF5F9EA0)
cardDarkColor → const Color
const Color(0xFF2A2E35)
chartreuse → const Color
const Color(0xFF7FFF00)
chocolate → const Color
const Color(0xFFD2691E)
coral → const Color
const Color(0xFFFF7F50)
cornflowerBlue → const Color
const Color(0xFF6495ED)
cornSilk → const Color
const Color(0xFFFFF8DC)
crimson → const Color
const Color(0xFFDC143C)
currencyDollar → const String
currencyEuro → const String
currencyRupee → const String
cyan → const Color
const Color(0xFF00FFFF)
darkBlue → const Color
const Color(0xFF00008B)
darkCyan → const Color
const Color(0xFF008B8B)
darkGoldenRod → const Color
const Color(0xFFB8860B)
darkGray → const Color
const Color(0xFFA9A9A9)
darkGreen → const Color
const Color(0xFF006400)
darkGrey → const Color
const Color(0xFFA9A9A9)
darkKhaki → const Color
const Color(0xFFBDB76B)
darkMagenta → const Color
const Color(0xFF8B008B)
darkOliveGreen → const Color
const Color(0xFF556B2F)
darkOrange → const Color
const Color(0xFFFF8C00)
darkOrchid → const Color
const Color(0xFF9932CC)
darkRed → const Color
const Color(0xFF8B0000)
darkSalmon → const Color
const Color(0xFFE9967A)
darkSeaGreen → const Color
const Color(0xFF8FBC8F)
darkSlateBlue → const Color
const Color(0xFF483D8B)
darkSlateGray → const Color
const Color(0xFF2F4F4F)
darkSlateGrey → const Color
const Color(0xFF2F4F4F)
darkTurquoise → const Color
const Color(0xFF00CED1)
darkViolet → const Color
const Color(0xFF9400D3)
deepPink → const Color
const Color(0xFFFF1493)
deepSkyBlue → const Color
const Color(0xFF00BFFF)
dimGray → const Color
const Color(0xFF696969)
dimGrey → const Color
const Color(0xFF696969)
dodgerBlue → const Color
const Color(0xFF1E90FF)
errorColor → const Color
const Color(0xFFFF6347)
fireBrick → const Color
const Color(0xFFB22222)
floralWhite → const Color
const Color(0xFFFFFAF0)
forestGreen → const Color
const Color(0xFF228B22)
fuchsia → const Color
const Color(0xFFFF00FF)
gainsBoro → const Color
const Color(0xFFDCDCDC)
ghostWhite → const Color
const Color(0xFFF8F8FF)
gold → const Color
const Color(0xFFFFD700)
goldenRod → const Color
const Color(0xFFDAA520)
gray → const Color
const Color(0xFF808080)
greenColor → const Color
const Color(0xFF008000)
greenYellow → const Color
const Color(0xFFADFF2F)
grey → const Color
const Color(0xFF808080)
honeyDew → const Color
const Color(0xFFF0FFF0)
hotPink → const Color
const Color(0xFFFF69B4)
indianRed → const Color
const Color(0xFFCD5C5C)
indigo → const Color
const Color(0xFF4B0082)
ivory → const Color
const Color(0xFFFFFFF0)
khaki → const Color
const Color(0xFFF0E68C)
lavender → const Color
const Color(0xFFE6E6FA)
lavenderBlush → const Color
const Color(0xFFFFF0F5)
lawnGreen → const Color
const Color(0xFF7CFC00)
lemonChiffon → const Color
const Color(0xFFFFFACD)
lightBlue → const Color
const Color(0xFFADD8E6)
lightCoral → const Color
const Color(0xFFF08080)
lightCyan → const Color
const Color(0xFFE0FFFF)
lightGoldenRodYellow → const Color
const Color(0xFFFAFAD2)
lightGray → const Color
const Color(0xFFD3D3D3)
lightGreen → const Color
const Color(0xFF90EE90)
lightGrey → const Color
const Color(0xFFD3D3D3)
lightPink → const Color
const Color(0xFFFFB6C1)
lightSalmon → const Color
const Color(0xFFFFA07A)
lightSeaGreen → const Color
const Color(0xFF20B2AA)
lightSkyBlue → const Color
const Color(0xFF87CEFA)
lightSlateGray → const Color
const Color(0xFF778899)
lightSlateGrey → const Color
const Color(0xFF778899)
lightSteelBlue → const Color
const Color(0xFFB0C4DE)
lightYellow → const Color
const Color(0xFFFFFFE0)
lime → const Color
const Color(0xFF00FF00)
limeGreen → const Color
const Color(0xFF32CD32)
linen → const Color
const Color(0xFFFAF0E6)
magenta → const Color
const Color(0xFFFF00FF)
maroon → const Color
const Color(0xFF800000)
mediumAquaMarine → const Color
const Color(0xFF66CDAA)
mediumBlue → const Color
const Color(0xFF0000CD)
mediumOrchid → const Color
const Color(0xFFBA55D3)
mediumPurple → const Color
const Color(0xFF9370DB)
mediumSeaGreen → const Color
const Color(0xFF3CB371)
mediumSlateBlue → const Color
const Color(0xFF7B68EE)
mediumSpringGreen → const Color
const Color(0xFF00FA9A)
mediumTurquoise → const Color
const Color(0xFF48D1CC)
mediumVioletRed → const Color
const Color(0xFFC71585)
midnightBlue → const Color
const Color(0xFF191970)
mintCream → const Color
const Color(0xFFF5FFFA)
mistyRose → const Color
const Color(0xFFFFE4E1)
moccasin → const Color
const Color(0xFFFFE4B5)
const Color(0xFFFFDEAD)
const Color(0xFF000080)
oldLace → const Color
const Color(0xFFFDF5E6)
olive → const Color
const Color(0xFF808000)
oliveDrab → const Color
const Color(0xFF6B8E23)
orange → const Color
const Color(0xFFFFA500)
orangeRed → const Color
const Color(0xFFFF4500)
orchid → const Color
const Color(0xFFDA70D6)
paleGoldenRod → const Color
const Color(0xFFEEE8AA)
paleGreen → const Color
const Color(0xFF98FB98)
paleTurquoise → const Color
const Color(0xFFAFEEEE)
paleVioletRed → const Color
const Color(0xFFDB7093)
papayaWhip → const Color
const Color(0xFFFFEFD5)
peachPuff → const Color
const Color(0xFFFFDAB9)
peru → const Color
const Color(0xFFCD853F)
pink → const Color
const Color(0xFFFFC0CB)
playStoreBaseURL → const String
plum → const Color
const Color(0xFFDDA0DD)
powderBlue → const Color
const Color(0xFFB0E0E6)
purple → const Color
const Color(0xFF800080)
rebeccaPurple → const Color
const Color(0xFF663399)
redColor → const Color
const Color(0xFFFF0000)
rosyBrown → const Color
const Color(0xFFBC8F8F)
royalBlue → const Color
const Color(0xFF4169E1)
saddleBrown → const Color
const Color(0xFF8B4513)
salmon → const Color
const Color(0xFFFA8072)
sandyBrown → const Color
const Color(0xFFF4A460)
scaffoldDarkColor → const Color
const Color(0xFF12181B)
scaffoldLightColor → const Color
const Color(0xFFFAFAFA)
seaGreen → const Color
const Color(0xFF2E8B57)
seaShell → const Color
const Color(0xFFFFF5EE)
sienna → const Color
const Color(0xFFA0522D)
silver → const Color
const Color(0xFFC0C0C0)
skyBlue → const Color
const Color(0xFF87CEEB)
slateBlue → const Color
const Color(0xFF6A5ACD)
slateGray → const Color
const Color(0xFF708090)
slateGrey → const Color
const Color(0xFF708090)
snow → const Color
const Color(0xFFFFFAFA)
spacingControl → const int
spacingControlHalf → const int
spacingLarge → const int
spacingMedium → const int
spacingStandard → const int
spacingStandardNew → const int
spacingXL → const int
spacingXXL → const int
springGreen → const Color
const Color(0xFF00FF7F)
steelBlue → const Color
const Color(0xFF4682B4)
tan → const Color
const Color(0xFFD2B48C)
teal → const Color
const Color(0xFF008080)
textPrimaryColor → const Color
const Color(0xFF2E3033)
textSecondaryColor → const Color
const Color(0xFF757575)
THEME_MODE_INDEX → const String
thistle → const Color
const Color(0xFFD8BFD8)
tomato → const Color
const Color(0xFFFF6347)
transparentColor → const Color
const Color(0x00000000)
turquoise → const Color
const Color(0xFF40E0D0)
viewLineColor → const Color
const Color(0xFFEAEAEA)
violet → const Color
const Color(0xFFEE82EE)
wheat → const Color
const Color(0xFFF5DEB3)
white → const Color
const Color(0xFFFFFFFF)
whiteColor → const Color
whiteSmoke → const Color
const Color(0xFFF5F5F5)
yellow → const Color
const Color(0xFFFFFF00)
yellowGreen → const Color
const Color(0xFF9ACD32)


alphaRegExp RegExp
read / write
appBarBackgroundColorGlobal Color
read / write
appButtonBackgroundColorGlobal Color
read / write
appButtonScaleAnimationDurationGlobal int?
read / write
defaultAppBarElevation double
read / write
defaultAppButtonElevation double
read / write
defaultAppButtonRadius double
read / write
defaultAppButtonShapeBorder ShapeBorder?
read / write
defaultAppButtonTextColorGlobal Color
read / write
defaultBlurRadius double
read / write
defaultCurrencySymbol String
read / write
defaultDialogShape ShapeBorder?
read / write
defaultElevation int
read / write
defaultInkWellHoverColor Color?
read / write
defaultInkWellSplashColor Color?
read / write
defaultLoaderAccentColorGlobal Color?
read / write
defaultLoaderBgColorGlobal Color
read / write
defaultRadius double
read / write
defaultSpreadRadius double
read / write
desktopBreakpointGlobal double
read / write
enableAppButtonScaleAnimationGlobal bool
read / write
errorInternetNotAvailable String
read / write
errorMessage String
read / write
errorSomethingWentWrong String
read / write
errorThisFieldRequired String
read / write
fontFamilyBoldGlobal String?
read / write
fontFamilyPrimaryGlobal String?
read / write
fontFamilySecondaryGlobal String?
read / write
fontWeightBoldGlobal FontWeight
read / write
fontWeightPrimaryGlobal FontWeight
read / write
fontWeightSecondaryGlobal FontWeight
read / write
getSelectedThemeMode String?
isAndroid bool
isApple bool
isDesktop bool
isGoogle bool
isIos bool
isLinux bool
isMacOS bool
isMobile bool
isWeb bool
isWindows bool
localeLanguageList List<LanguageDataModel>
read / write
operatingSystemName String
operatingSystemVersion String
passwordLengthGlobal int
read / write
selectedLanguageDataModel LanguageDataModel?
read / write
shadowColorGlobal Color
read / write
sharedPreferences SharedPreferences
read / write
tabletBreakpointGlobal double
read / write
textBoldSizeGlobal double
read / write
textPrimaryColorGlobal Color
read / write
textPrimarySizeGlobal double
read / write
textSecondaryColorGlobal Color
read / write
textSecondarySizeGlobal double
read / write


appBarWidget(String title, {Widget? child, Widget? titleWidget, List<Widget>? actions, Color? color, bool center = false, Color? textColor, int textSize = 20, bool showBack = true, Color? shadowColor, double? elevation, Widget? backWidget, Brightness? brightness, SystemUiOverlayStyle? systemUiOverlayStyle, TextStyle? titleTextStyle, PreferredSizeWidget? bottom, Widget? flexibleSpace}) AppBar
Default AppBar
boldTextStyle({int? size, Color? color, FontWeight? weight, String? fontFamily, double? letterSpacing, FontStyle? fontStyle, double? wordSpacing, TextDecoration? decoration, TextDecorationStyle? textDecorationStyle, TextBaseline? textBaseline, Color? decorationColor, Color? backgroundColor}) TextStyle
boxDecorationDefault({BorderRadiusGeometry? borderRadius, Color? color, Gradient? gradient, BoxBorder? border, BoxShape? shape, BlendMode? backgroundBlendMode, List<BoxShadow>? boxShadow, DecorationImage? image}) Decoration
boxDecorationRoundedWithShadow(int radiusAll, {Color backgroundColor = whiteColor, Color? shadowColor, double? blurRadius, double? spreadRadius, Offset offset = const Offset(0.0, 0.0)}) Decoration
rounded box decoration with shadow
boxDecorationWithRoundedCorners({Color backgroundColor = whiteColor, BorderRadius? borderRadius, LinearGradient? gradient, BoxBorder? border, List<BoxShadow>? boxShadow, DecorationImage? decorationImage, BoxShape boxShape = BoxShape.rectangle}) Decoration
rounded box decoration
boxDecorationWithShadow({Color backgroundColor = whiteColor, Color? shadowColor, double? blurRadius, double? spreadRadius, Offset offset = const Offset(0.0, 0.0), LinearGradient? gradient, BoxBorder? border, List<BoxShadow>? boxShadow, DecorationImage? decorationImage, BoxShape boxShape = BoxShape.rectangle, BorderRadius? borderRadius}) Decoration
box decoration with shadow
buildTitleWidget(BuildContext context, DialogType dialogType, Color? primaryColor, Widget? customCenterWidget, double height, double width, String? centerImage) Widget
clearSharedPref() Future<bool>
clear SharedPref
countDays(int difference) String
Converts the time difference to a number of days. This function truncates to the lowest day. returns ("1 day" OR "X days")
countHours(int difference) String
Converts the time difference to a number of hours. This function truncates to the lowest hour. returns ("1 hour" OR "X hours")
countMinutes(int difference) String
Converts the time difference to a number of minutes. This function truncates to the lowest minute. returns ("1 minute" OR "X minutes")
countMonths(int difference) String
Converts the time difference to a number of months. This function rounds to the nearest month. returns ("1 month" OR "X months" OR "1 year")
countSeconds(int difference) String
Converts the time difference to a number of seconds. This function truncates to the lowest second. returns ("Just now" OR "X seconds")
countWeeks(int difference) String
Converts the time difference to a number of weeks. This function truncates to the lowest week. returns ("1 week" OR "X weeks" OR "1 month")
countYears(int difference) String
Converts the time difference to a number of years. This function truncates to the lowest year. returns ("1 year" OR "X years")
createMaterialColor(Color color) MaterialColor
Returns MaterialColor from Color
createRichText({required List<TextSpan> list, TextOverflow overflow = TextOverflow.clip, int? maxLines, TextAlign textAlign = TextAlign.left, TextDirection? textDirection, StrutStyle? strutStyle}) RichText
currentMillisecondsTimeStamp() int
return current time in milliseconds
currentTimeStamp() int
return current timestamp
daysInMonth(int monthNum, int year) int?
returns number of days in given month
defaultBoxShadow({Color? shadowColor, double? blurRadius, double? spreadRadius, Offset offset = const Offset(0.0, 0.0)}) List<BoxShadow>
default box shadow
defaultInputDecoration({String? hint, String? label, TextStyle? textStyle}) InputDecoration
returns default InputDecoration for AppTextField widget
defaultPlaceHolder(BuildContext context, DialogType dialogType, double? height, double? width, Color? primaryColor, {Widget? child}) Widget
dialogShape([double? borderRadius]) ShapeBorder
finish(BuildContext context, [Object? result]) → void
Go back to previous screen.
formatTime(int timestamp) String
returns how much time ago from timestamp
getBool(String key, {dynamic defaultValue = false}) Future<bool>
Returns a Bool if exists in SharedPref
getBoolAsync(String key, {bool defaultValue = false}) bool
Returns a Bool if exists in SharedPref
getCenteredImage(BuildContext context, DialogType dialogType) Widget?
getColorFromHex(String hexColor, {Color? defaultColor}) Color
Returns Color from hex String. [...]
getDialogPrimaryColor(BuildContext context, DialogType dialogType) Color
getDouble(String key, {dynamic defaultValue = 0.0}) Future<double>
Returns a Double if exists in SharedPref
getDoubleAsync(String key, {double defaultValue = 0.0}) double
Returns a Double if exists in SharedPref
getIcon(DialogType dialogType, {double? size}) Widget
getInt(String key, {dynamic defaultValue = 0}) Future<int>
Returns a Int if exists in SharedPref
getIntAsync(String key, {int defaultValue = 0}) int
Returns a Int if exists in SharedPref
getJSONAsync(String key, {Map<String, dynamic>? defaultValue}) Map<String, dynamic>
Returns a JSON if exists in SharedPref
getPositiveText(DialogType dialogType) String
getSelectedLanguageModel({String defaultLanguage = 'en'}) LanguageDataModel?
getSharedPref() Future<SharedPreferences>
Returns SharedPref Instance
getString(String key, {dynamic defaultValue = ''}) Future<String>
Returns a String if exists in SharedPref
getStringAsync(String key, {String defaultValue = ''}) String
Returns a String if exists in SharedPref
getStringListAsync(String key) List<String>?
Returns a StringList if exists in SharedPref
getTitle(DialogType dialogType) String
hasMatch(String? s, String p) bool
hideKeyboard(dynamic context) → void
Hide soft keyboard
hideStatusBar() Future<void>
This function will hide status bar
initialize({double? defaultDialogBorderRadius, List<LanguageDataModel>? aLocaleLanguageList}) Future<void>
invokeNativeMethod<T>(String channel, String method, [dynamic arguments]) Future<T?>
Invoke Native method and get result
isNetworkAvailable() Future<bool>
return true is network is available
isSnapshotLoading(AsyncSnapshot snap, {bool checkHasData = false}) bool
Returns true is snapshot is loading
launchNewScreen<T>(BuildContext context, String tag) Future<T?>
Go to new screen with provided screen tag. [...]
launchNewScreenWithNewTask<T>(BuildContext context, String tag) Future<T?>
Removes all previous screens from the back stack and redirect to new screen with provided screen tag [...]
leapYear(int year) bool
return true if given year is an leap year
log(Object? value) → void
Prints only if in debug or profile mode
paste() Future<String>
Returns a string from Clipboard
pasteObject() Future
Returns a string from Clipboard
platformName() String
Returns current PlatformName
primaryTextStyle({int? size, Color? color, FontWeight? weight, String? fontFamily, double? letterSpacing, FontStyle? fontStyle, double? wordSpacing, TextDecoration? decoration, TextDecorationStyle? textDecorationStyle, TextBaseline? textBaseline, Color? decorationColor, Color? backgroundColor}) TextStyle
radius([double? radius]) BorderRadius
returns Radius
radiusCircular([double? radius]) Radius
returns Radius
radiusOnly({double? topRight, double? topLeft, double? bottomRight, double? bottomLeft}) BorderRadius
returns custom Radius on each side
removeKey(String key) Future<bool>
remove key from SharedPref
scrollBehaviour() → (Widget Function?(BuildContext, Widget?)?)
Custom scroll behaviour
secondaryTextStyle({int? size, Color? color, FontWeight? weight, String? fontFamily, double? letterSpacing, FontStyle? fontStyle, double? wordSpacing, TextDecoration? decoration, TextDecorationStyle? textDecorationStyle, TextBaseline? textBaseline, Color? decorationColor, Color? backgroundColor}) TextStyle
setBool(String key, bool value) Future<bool>
add a Bool in SharedPref
setBoolAsync(String key, bool value) Future<bool>
add a Bool in SharedPref
setDouble(String key, double value) Future<bool>
add a Double in SharedPref
setDoubleAsync(String key, double value) Future<bool>
//////////////////////////////////////////////////////////////////// DEPRECATED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
add a Double in SharedPref
setInt(String key, int value) Future<bool>
add a Int in SharedPref
setIntAsync(String key, int value) Future<bool>
add a Int in SharedPref
setJSONAsync(String key, String value) Future<bool>
add a JSON in SharedPref
setOrientationLandscape() → void
Set orientation to landscape
setOrientationPortrait() → void
Set orientation to portrait
setStatusBarColor(Color statusBarColor, {Color? systemNavigationBarColor, Brightness? statusBarBrightness, Brightness? statusBarIconBrightness, int delayInMilliSeconds = 200}) Future<void>
Change status bar Color and Brightness
setString(String key, String value) Future<bool>
add a String in SharedPref
setStringAsync(String key, String value) Future<bool>
add a String in SharedPref
setValue(String key, dynamic value) Future<bool>
Add a value in SharedPref based on their type - Must be a String, int, bool, double, Map<String, dynamic> or StringList
showConfirmDialog<bool>(dynamic context, String title, {String positiveText = 'Yes', String negativeText = 'No', Color? buttonColor, bool? barrierDismissible, Function? onAccept}) Future<bool?>
show confirm dialog box
showConfirmDialogCustom(BuildContext context, {String? title, String? subTitle, String? positiveText, String? negativeText, String? centerImage, Widget? customCenterWidget, Color? primaryColor, ShapeBorder? shape, required Function onAccept, Function? onCancel, DialogType dialogType = DialogType.CONFIRMATION, bool barrierDismissible = true, double height = 140, double width = 220, bool cancelable = true}) Future<bool?>
show confirm dialog box
showInDialog<T>(BuildContext context, {Widget? title, Widget? child, Widget? builder(BuildContext)?, ShapeBorder? shape, TextStyle? titleTextStyle, EdgeInsetsGeometry? contentPadding, Color? backgroundColor, double? elevation, List<Widget>? actions, bool barrierDismissible = true}) Future<T?>
show child widget in dialog
showStatusBar() Future<void>
This function will show status bar
snackBar(BuildContext context, {String title = '', Widget? content, SnackBarAction? snackBarAction, Function? onVisible, Color? textColor, Color? backgroundColor, EdgeInsets? margin, Animation<double>? animation, double? width, ShapeBorder? shape, Duration? duration, SnackBarBehavior? behavior, double? elevation}) → void
Show SnackBar
snapWidgetHelper<T>(AsyncSnapshot<T> snap, {Widget? errorWidget, Widget? loadingWidget, String? defaultErrorMessage, bool checkHasData = false}) Widget
Handle error and loading widget when using FutureBuilder or StreamBuilder
toast(String? value, {ToastGravity gravity = ToastGravity.BOTTOM, dynamic length = Toast.LENGTH_SHORT, Color? bgColor, Color? textColor}) → void
Toast for default time
toastLong(String value, {ToastGravity gravity = ToastGravity.BOTTOM, dynamic length = Toast.LENGTH_LONG, Color? bgColor, Color? textColor}) → void
Toast for long period of time


Connection status check result.
The status of the location service authorization.
Toast Length Only for Android Platform
ToastGravity Used to define the position of the Toast on the screen


BoolWidgetBuilder = Widget Function(BuildContext context, bool isHovering)
PositionedToastBuilder = Widget Function(BuildContext context, Widget child)
Signature for a function to buildCustom Toast
RatingChangeCallback = void Function(double rating)