A collection of Dart extensions I use across my Flutter projects. Copy what you need — no package setup required.
Capitalize the first letter of any string safely, even if null.
'hello'.capitalizeFirst() // 'Hello'
'hello world'.capitalizeFirst() // 'Hello world'
null.capitalizeFirst() // ''Quickly create SizedBox, BorderRadius, and Duration from any number.
16.kH // SizedBox(height: 16)
16.kW // SizedBox(width: 16)
12.radius // BorderRadius.circular(12)
300.ms // Duration(milliseconds: 300)
2.seconds // Duration(seconds: 2)Add padding to any widget without wrapping it manually.
Text('Hello').paddingAll(16)
Text('Hello').paddingSymmetric(horizontal: 16, vertical: 8)
Text('Hello').paddingOnly(left: 12, top: 8)Access theme, screen size, and navigation directly from BuildContext.
context.screenHeight // MediaQuery height
context.screenWidth // MediaQuery width
context.isDark // true if dark mode
context.colors.primary // ColorScheme primary
context.pop() // Navigator.pop
context.push(MyPage()) // Navigator.pushHandy date checks and human-readable formatting.
DateTime.now().isToday // true
someDate.isYesterday // true / false
someDate.isWeekend // true / false
someDate.timeAgo // '5m ago' / '2h ago' / '3d ago'
someDate.formatted // '08 May 2026'
someDate.timeOnly // '09:30 AM'Remove duplicate elements from any list without extra setup.
[1, 2, 2, 3].unique() // [1, 2, 3]
['a', 'b', 'a'].unique() // ['a', 'b']No more isVisible ? widget : SizedBox.shrink().
Text('Premium Feature').visible(isPremiumUser);No installation needed. Just copy the file you need into your project and import it.
import 'your_project/extensions/widget_extension.dart';Found a useful extension? PRs are welcome.
Made with 🤍 by junaidjamel