Fleasy helps create Flutter apps easier by providing useful and easy to use extensions, helper classes and widgets.
The goal is that by using this package you have to write less (repeating) and more clean and readable code.
Overview
- Extensions on StringandString?
- Extensions on BuildContext(Adaptive helpers)
- Extensions on BuildContext(Theme helpers)
- Extensions on BuildContext(Navigation helpers)
- Extensions on BuildContext(Flashbars)
- Extensions on List?
- Extensions on List
- Extensions on DateTime
- Datehelper class
- Insetshelper class
- Flutter Widgets
- Analysis Options
Features
All features with links to their page in the documentation:
- 
Extensions onStringandString?:Note: All getters also do a null check if used on String?.- 
isNotBlankWhether the string contains characters except of whitespace characters.
- 
isBlankWhether the string is either empty or solely made of whitespace characters.
- 
toNullIfBlank()Returns null if the stringisBlankor it's text if itisNotBlank.
- 
isEmailWhether the string is a valid email.
- 
isUrlWhether the string is a valid url.
- 
isEasyPasswordWhether the string is a valid easy password.
- 
isMediumPasswordWhether the string is a valid medium password.
- 
isStrongPasswordWhether the string is a valid strong password.
- 
addHttps()Adds https:// to the link if it does not contain https:// or http:// already. This is helpful to make a link openable when using the url_launcher package for example.
 
- 
- 
Extensions onBuildContext(Adaptive helpers):- 
screenSizeTheMediaQueryData.sizefrom the nearestMediaQueryancestor.
- 
screenWidthThe horizontal extent of the screen size.
- 
screenHeightThe vertical extent of the screen size.
- 
screenOrientationTheMediaQueryData.orientationfrom the nearestMediaQueryancestor.
- 
screenIsLandscapeWhether the device is in landscape mode.
- 
screenIsPortraitWhether the device is in portrait mode.
- 
formFactor()Returns the correct FormFactor based on the ScreenWidthBreakpoints.
- 
byFormFactorReturns either onMobile, onTablet or onDesktop depending on the current formFactor. Example:int columns = context.byFormFactor<int>(onMobile: 1, onTablet: 2, onDesktop: 4);
 
- 
- 
Extensions onBuildContext(Theme helpers):- 
themeThe data from the closest Theme instance that encloses the given context.
- 
isDarkThemeWhether the theme brightness is dark.
- 
isLightThemeWhether the theme brightness is light.
 
- 
- 
Extensions onBuildContext(Navigation helpers):- 
pushPage(...)Push the given page onto the navigator.
- 
pushRoute(...)Push the given route onto the navigator.
- 
popPage(...)Pop the top-most route off the navigator and dismiss the keyboard.
- 
canPopPage()Whether the navigator can be popped.
- 
dismissKeyboard()Dismisses the keyboard.
 
- 
- 
Extensions onBuildContext(Flashbars):The extensions use the awesome flash package: - 
showSuccessFlashbar(...)Shows a success flashbar/toast with a customizable text.
- 
showInfoFlashbar(...)Shows an info flashbar/toast with a customizable text.
- 
showErrorFlashbar(...)Shows an error flashbar/toast with a customizable text (optional).
- 
showNoConnectionFlashbar()Shows a no connection flashbar/toast with a customizable text (optional).
 
- 
- 
Extensions onList?:- 
isNotBlankWhether the list is not empty nor null.
- 
isBlankWhether the list is empty or null.
 
- 
- 
Extensions onList:- 
find(...)Returns either the first element of the list which satisfies the provided test or null if there is none.
 
- 
- 
Extensions onDateTime:- 
copyWith(...)Returns a copy with the overridden (given) attributes.
- 
format(...)Returns a String which represents the date formatted by the given pattern.
- 
isTodayWhether the date is today.
- 
isYesterdayWhether the date is yesterday.
- 
isTomorrowWhether the date is tomorrow.
- 
isFutureDayWhether the date is a day in the future.
- 
isSameDay(...)Whether the date is on the same day (regardless of the time) as the given date.
- 
timeIsZeroWhether the time of the date is zero/empty.
- 
copyWithEmptyTime()Returns a copy with time set to zero/empty.
 
- 
- 
Datehelper class:- 
today()DateTime.now()without time (time set to zero).
- 
tomorrow()TheDateTimeof tomorrow (without time (time set to zero)).
- 
yesterday()TheDateTimeof yesterday (without time (time set to zero)).
 
- 
- 
Insetshelper class:A single source of truth for styling values like padding, spacing, corner shape, font sizes, and so on. These constants can then be used in place of hard-coded numeric values. 
- 
Flutter Widgets:- 
GapA wrapper aroundSizedBoxfor making consistent gaps. Example: Instead ofSizedBox(width: 4.0)you can just writeGap.w4().
- 
EasyFutureBuilderA wrapper aroundFutureBuilderwhich makes it easy to display the various states of fetching data from the givenFuture. See example.
- 
EasyStreamBuilderA wrapper aroundStreamBuilderwhich makes it easy to display the various states of streaming data from the givenStream. See example.
 
- 
- 
Analysis options:You can use the same analysis options which this package uses by simply including them in your analysis_options.yamlfile:include: package:fleasy/analysis_options.yamlThey are based on: - package:flutter_lints (therefore also package:lints)
- my favorite lint rules which are not present in package:flutter_lints
 For more details, have a look at the analysis_options.yamlfile here.
Note:
This package is still in early stages. If you notice any bugs not present in issues, please file a new issue. If you are willing to fix or enhance things yourself, you are very welcome to make a pull request.
Also: Feedback and suggestions are very welcome. Just open an issue.

