flutter_essentials_plus 1.0.2
flutter_essentials_plus: ^1.0.2 copied to clipboard
A modern collection of extensions, validators, formatters, and helper utilities that reduce Flutter boilerplate while keeping code clean, readable, and maintainable.
Flutter Essentials (Dev Utils) v1.0.0 #
A modern collection of extensions, validators, formatters, and helper utilities that reduce Flutter boilerplate while keeping code clean, readable, and maintainable.
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
flutter_essentials: ^1.0.0
Quick Start #
import 'package:flutter_essentials_plus/flutter_essentials_plus.dart';
Features #
1. Context Extensions #
Remove repetitive BuildContext code:
context.width
context.height
context.screenSize
context.isDark
context.isLight
context.theme
context.colorScheme
context.textTheme
context.padding
context.viewInsets
context.safeArea
context.orientation
context.devicePixelRatio
context.statusBarHeight
context.navigationBarHeight
context.keyboardHeight
context.hideKeyboard()
context.push(page)
context.replace(page)
context.pop()
context.showSnackBar()
context.showLoader()
context.hideLoader()
context.showBottomSheet()
context.showDialog()
2. String Extensions #
Save time everywhere:
text.capitalize
text.titleCase
text.camelCase
text.snakeCase
text.kebabCase
text.pascalCase
text.constantCase
text.reverse
text.initials
text.removeWhitespace
text.removeEmoji
text.onlyDigits
text.onlyLetters
text.truncate(30)
text.maskEmail()
text.maskPhone()
text.maskCNIC()
text.isEmail
text.isPhone
text.isURL
text.isNumeric
text.isAlphabet
text.isAlphaNumeric
text.isEmoji
text.containsEmoji
text.containsArabic
text.containsUrdu
text.containsHtml
text.extractEmails()
text.extractUrls()
text.extractPhones()
text.extractHashtags()
text.extractMentions()
3. Number Extensions #
1000.format()
500000.formatCompact()
1500000.formatCurrency()
125648.bytesToReadable()
25.percentOf(500)
500.clampValue(0, 1000)
20.isEven
15.isOdd
30.seconds
10.minutes
2.hours
7.days
4. DateTime Extensions #
Among the most-used utilities:
date.timeAgo
date.isToday
date.isYesterday
date.isTomorrow
date.startOfDay
date.endOfDay
date.startOfWeek
date.endOfWeek
date.startOfMonth
date.endOfMonth
date.age
date.daysBetween(other)
date.monthName
date.weekdayName
date.isWeekend
date.isLeapYear
5. Widget Extensions #
Compose widgets with readable chains instead of nesting many wrappers:
Text("Hello")
.paddingAll(16)
.center()
.card()
.shadow()
.animateFade()
// Other useful helpers:
widget.visible(bool)
widget.opacity(.5)
widget.rotate()
widget.scale()
widget.blur()
widget.hero()
widget.tooltip()
widget.gesture()
widget.onTap()
widget.expand()
widget.safeArea()
widget.clipRadius()
widget.gradient()
widget.loading()
6. BuildContext Navigation #
context.push(HomePage())
context.pushNamed("/home")
context.replace(HomePage())
context.pop()
context.popUntil("/home")
context.clearStack(HomePage())
context.pushAndRemoveUntil(HomePage())
7. Validators #
Support both global and Pakistan-specific formats:
Validators.email
Validators.password
Validators.url
Validators.phone
Validators.cnic
Validators.iban
Validators.swift
Validators.creditCard
Validators.postalCode
Validators.ntn
Validators.passport
Validators.username
8. Formatting #
Ready-to-use static formatters:
Formatters.currency(150000)
Formatters.phone('923001234567')
Formatters.iban('PK00BANK...')
Formatters.cnic('3520212345678')
Formatters.creditCard('12345678...')
Formatters.date(DateTime.now())
Formatters.time(DateTime.now())
Formatters.duration(Duration(hours: 1))
Formatters.fileSize(1048576)
Formatters.percentage(0.75)
Formatters.ordinal(1)
Formatters.distance(1500)
9. Helper Widgets #
Ready-to-use UI components that solve common problems:
LoadingOverlay(isLoading: true, child: ...)
DebounceButton(onPressed: () {}, child: Text('Submit'))
ExpandableText('Very long text...', maxLines: 2)
PasswordStrength(password: 'MyPass123!')
OtpTimer(seconds: 60, onResend: () {})
NetworkImagePlaceholder('https://url.com')
AvatarGenerator('John Doe')
GradientBorder(...)
ShimmerBox(width: 100, height: 20)
ShimmerEffect(child: ...)
EmptyState(title: 'No Data')
ErrorState(message: 'Failed', onRetry: () {})
RetryButton(onRetry: () {})
CopyText('Text to copy')
AsyncBuilder(...)
ResponsiveBuilder(...)
AnimatedSwitcherX(...)
10. Animations #
Simple extension-based animations keep code concise:
widget.fade()
widget.slide()
widget.zoom()
widget.animatedRotate()
widget.flip()
widget.shake()
widget.animatedScale()
widget.bounce()
widget.elastic()
widget.wiggle()
11. Utilities #
ClipboardHelper.copy('text')
LaunchHelper.url('https://google.com')
DeviceHelper.getDeviceModel()
PlatformHelper.isMobile
PermissionHelper.request(Permission.camera)
InternetHelper.hasConnection()
BatteryHelper.getLevel()
StorageHelper.setString('key', 'value')
Logger.info('Message')
Debouncer().run(() {})
Throttle().run(() {})
Retry.execute(() async {})
UuidGenerator.generate()
RandomGenerator.string(10)
12. Responsive Helpers #
context.isPhone
context.isTablet
context.isDesktop
context.isLandscape
context.isPortrait
context.breakpoint
context.widthPercent(20)
context.heightPercent(50)
13. Color Extensions #
color.lighten()
color.darken()
color.withOpacitySafe(0.5)
ColorExtensions.random()
color.invert()
color.hex
color.gradientTo(other)
14. Iterable & List Extensions #
list.firstOrNull
list.lastOrNull
list.random()
list.shuffleCopy()
list.chunk(5)
list.groupBy((e) => e.id)
list.unique()
list.sorted()
list.insertBetween(element)
15. Map Extensions #
map.getString('key')
map.getInt('age')
map.getDouble('price')
map.getBool('isActive')
map.getList('items')
map.getMap('user')
map.deepCopy()
map.removeNulls()
License #
MIT License