A collection of useful classes and extensions so obvious you'll wonder why they aren't offical
Install via flutter pub add
:
dart pub add obvious
After years of copy-n-pasting the same constructor param values and other tedious actions as Flutter developers, it was time to package these actions into sensible, almost obvious classes and extensions we can all benefit from.
The easiest example (and my favorite) is needing to set all but one argument for EdgeInsets.only
to the same value.
That's when ObviousEdgeInsets.except()
was born:
ObviousEdgeInsets.except(bottom: 8)
// is synonimous with:
EdgeInsets.only(left: 8, top: 8, right: 8)
ObviousEdgeInsets.except
ObviousConditionalExpanded
insetAll
insetHorizontal
insetVertical
insetLeft
insetTop
insetBottom
insetRight
ms
seconds
minutes
hours
days
heightBox
widthBox
screenHeight
screenWidth
aspectRatio
isMobile
padding
viewPadding
viewInsets
isTablet
isDesktop
push
pushReplacement
pushAndRemoveUntil
pushNamed
pushReplacementNamed
pushNamedAndRemoveUntil
pop
maybePop
popAndPushNamed
showNewDialog
showSnackbar
This project was heavily inspired by other libraries like:
- flutter_animate (num to Duration)
- super_extensions (BuildContext to Navigator)